EventHandler for report item? [message #250510] |
Tue, 31 July 2007 09:12 |
Eclipse User |
|
|
|
Originally posted by: john.spangenberg.geodan.com
Hi,
My report design has an input report parameter named 'xmlFile' with data
type String.
I do not want to pass 'xmlFile' into a data set. Instead, I want to
parse the value of 'xmlFile' first, and then I want to pass the result
of the parsing (could be a value of a node for example) to a data set.
I was thinking about writing an EventHandler class on a report
parameter. In this case 'xmlFile'.
Question:
Which EventHandler interface do I have to implement and which event in
particular?
I would appreciate your help.
Many thanks in advance.
Regards,
John
|
|
|
Re: EventHandler for report item? [message #250634 is a reply to message #250510] |
Tue, 31 July 2007 20:25 |
Eclipse User |
|
|
|
Originally posted by: jasonweathersby.alltel.net
John,
There is not an event handler for the parameters.
You could do this in the beforeOpen script of a scripted data set like this:
importPackage(Packages.javax.xml.parsers);
importPackage(Packages.java.io);
importPackage(Packages.org.w3c.dom);
var filename = "C:\\src\\ref.xml";
var factory = DocumentBuilderFactory.newInstance();
var builder = factory.newDocumentBuilder();
var document = builder.parse(new File(filename));
function getTagValue(tagName) {
var nlist = document.getElementsByTagName(tagName);
return nlist.item(0).getFirstChild().getNodeValue();
}
Then call getTagValue on what you need.
or use the ScriptedDataSetEventAdapter
Jason
John Spangenberg wrote:
> Hi,
>
> My report design has an input report parameter named 'xmlFile' with data
> type String.
> I do not want to pass 'xmlFile' into a data set. Instead, I want to
> parse the value of 'xmlFile' first, and then I want to pass the result
> of the parsing (could be a value of a node for example) to a data set.
>
> I was thinking about writing an EventHandler class on a report
> parameter. In this case 'xmlFile'.
>
> Question:
>
> Which EventHandler interface do I have to implement and which event in
> particular?
>
> I would appreciate your help.
>
> Many thanks in advance.
>
> Regards,
>
> John
>
>
>
>
>
|
|
|
Powered by
FUDForum. Page generated in 0.02504 seconds