Eclipse Community Forums - RDF feed
https://www.eclipse.org/forums/
Eclipse Community ForumsNewbie: Add new Element to report
https://www.eclipse.org/forums/index.php/mv/msg/212464/682126/#msg_682126
I am new to birt. So thank you for your patience. May be this was posted many times I didn't find it via google.
Here is the problem:
There is a webservice. I made a report with the Birt Report Designer 2.6.2 and these webservice is the scripted datasource. Via the open-Methode of the dataset I call the webservice and via the fetch-Methode the values the webservice transmitted get written to the OutputColumns.
One of the values the webservice sends is an array. The length of the array is variable. I know the length of the array in the fetch-Methode. So there is the point where I should add elements to the report in dependence of the length of the array. So I have found the Birt Programmers Reference and some code snippets via google.
Now I want to add some script to my report to dynamically add elements to my report. I searched for a global object to get to the report object with some kind of methods to add some elements.
I have found the class SessionHandle that I need for ReportDesignHandle with wich I can get the ElementFactory to create new Report-Elements. But I have difficulties with the session. I need a ReportDesignHandle that I can get from the SessionHandle but this SessionHandle I can only get via the createDesign()-Methode. But this means create a new report. And I think I don't need a new report. There is alreade a report created but I don't know how to catch him.
Please help.
Thanks for any help in advance.
Regards
Andreas]]>endiBirt 2011-06-10T13:16:26-00:00Re: Newbie: Add new Element to report
https://www.eclipse.org/forums/index.php/mv/msg/212464/682216/#msg_682216
can do this is in the beforeFactory script which will happen before any
datasets are called. You could call your web service method using
JavaScript in the beforeFactory and then get the report design handle to
add elements though. To get the design handle just use:
reportContext.getDesignHandle();
attached is a report where the entire report is constructed in the
beforeFactory using JavaScript. If there is a specific example you want
let me know.
Jason
<?xml version="1.0" encoding="UTF-8"?>
<report xmlns="http://www.eclipse.org/birt/2005/design" version="3.2.20"
id="1">
<property name="createdBy">Eclipse BIRT Designer Version
2.5.1.v20090903 Build <2.5.1.v20090917-1447></property>
<property name="units">in</property>
<property name="comments">Copyright (c) 2006 <<Your Company
Name here>></property>
<method name="beforeFactory"><![CDATA[importPackage(
Packages.org.eclipse.birt.report.model.api );
On 6/10/2011 9:16 AM, forums-noreply@eclipse.org wrote:
> Hi all,
>
> I am new to birt. So thank you for your patience. May be this was posted
> many times I didn't find it via google.
> Here is the problem:
>
> There is a webservice. I made a report with the Birt Report Designer
> 2.6.2 and these webservice is the scripted datasource. Via the
> open-Methode of the dataset I call the webservice and via the
> fetch-Methode the values the webservice transmitted get written to the
> OutputColumns.
> One of the values the webservice sends is an array. The length of the
> array is variable. I know the length of the array in the fetch-Methode.
> So there is the point where I should add elements to the report in
> dependence of the length of the array. So I have found the Birt
> Programmers Reference and some code snippets via google.
> Now I want to add some script to my report to dynamically add elements
> to my report. I searched for a global object to get to the report object
> with some kind of methods to add some elements.
> I have found the class SessionHandle that I need for ReportDesignHandle
> with wich I can get the ElementFactory to create new Report-Elements.
> But I have difficulties with the session. I need a ReportDesignHandle
> that I can get from the SessionHandle but this SessionHandle I can only
> get via the createDesign()-Methode. But this means create a new report.
> And I think I don't need a new report. There is alreade a report created
> but I don't know how to catch him.
>
>
> Please help.
>
> Thanks for any help in advance.
>
>
> Regards
>
> Andreas]]>Jason Weathersby2011-06-10T16:16:27-00:00Re: Newbie: Add new Element to report
https://www.eclipse.org/forums/index.php/mv/msg/212464/683714/#msg_683714
thank you very much for your reply. This is exactly what I was searching for.