Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » BIRT » Dynamic Parameter with Scripted Data Set
Dynamic Parameter with Scripted Data Set [message #638893] Fri, 12 November 2010 23:53 Go to next message
Mike S is currently offline Mike S
Messages: 7
Registered: November 2010
Junior Member
I am creating a report with an input parameter based on a data set. I need a combo box to populate based on a query. The datasource is scripted and therefore i am using a scripted data set. I have two data sets, one for the parameter and the one for the report. I assign the data set to the parameter dynamically and set the data set and the field.

The problem is when i run the report the combo box is not getting populated. I know the data set works because if i put it on the report i get results.

It is as if the query is not being executed before the parameters window comes up.

What do i need to do to have a combo box populate based on a scripted data set?

Thanks

Re: Dynamic Parameter with Scripted Data Set [message #638895 is a reply to message #638893] Sat, 13 November 2010 00:39 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason Weathersby
Messages: 9167
Registered: July 2009
Senior Member

Mike,

What version of BIRT are you using?
Can you try the attached report?

Jason

<?xml version="1.0" encoding="UTF-8"?>
<report xmlns="http://www.eclipse.org/birt/2005/design" version="3.2.22"
id="1">
<property name="comments">Copyright (c) 2006 &lt;&lt;Your Company
Name here>></property>
<property name="createdBy">Eclipse BIRT Designer Version
2.6.1.v20100902 Build &lt;2.6.1.v20100915-1750></property>
<property name="units">in</property>
<property name="layoutPreference">auto layout</property>
<parameters>
<scalar-parameter name="NewParameter" id="50">
<property name="valueType">dynamic</property>
<property name="dataSetName">SDSet2</property>
<expression name="valueExpr"
type="javascript">dataSetRow["col1"]</expression>
<property name="dataType">string</property>
<property name="distinct">true</property>
<property name="paramType">simple</property>
<property name="controlType">list-box</property>
<property name="mustMatch">false</property>
<property name="fixedOrder">true</property>
<structure name="format">
<property name="category">Unformatted</property>
</structure>
</scalar-parameter>
</parameters>
<data-sources>
<script-data-source name="SDS2" id="4"/>
</data-sources>
<data-sets>
<script-data-set name="SDSet2" id="5">
<list-property name="resultSetHints">
<structure>
<property name="position">1</property>
<property name="name">col1</property>
<property name="dataType">string</property>
</structure>
<structure>
<property name="position">2</property>
<property name="name">col2</property>
<property name="dataType">string</property>
</structure>
<structure>
<property name="position">3</property>
<property name="name">col3</property>
<property name="dataType">string</property>
</structure>
</list-property>
<list-property name="columnHints">
<structure>
<property name="columnName">col1</property>
</structure>
<structure>
<property name="columnName">col2</property>
</structure>
<structure>
<property name="columnName">col3</property>
</structure>
</list-property>
<structure name="cachedMetaData">
<list-property name="resultSet">
<structure>
<property name="position">1</property>
<property name="name">col1</property>
<property name="dataType">string</property>
</structure>
<structure>
<property name="position">2</property>
<property name="name">col2</property>
<property name="dataType">string</property>
</structure>
<structure>
<property name="position">3</property>
<property name="name">col3</property>
<property name="dataType">string</property>
</structure>
</list-property>
</structure>
<property name="dataSource">SDS2</property>
<method name="open"><![CDATA[tcount=0;]]></method>
<method name="fetch"><![CDATA[if (tcount < 20)
{
row["col1"] = "Test"+tcount;
row["col2"] = "Test2"+tcount;
row["col3"] = "Test3"+tcount;
tcount++;
return true;
}
else
return false;]]></method>
</script-data-set>
</data-sets>
<page-setup>
<simple-master-page name="Simple MasterPage" id="2">
<property name="topMargin">1in</property>
<property name="leftMargin">1.25in</property>
<property name="bottomMargin">1in</property>
<property name="rightMargin">1.25in</property>
<page-footer>
<text id="3">
<property name="contentType">html</property>
<text-property
name="content"><![CDATA[<value-of>new Date()</value-of>]]></text-property>
</text>
</page-footer>
</simple-master-page>
</page-setup>
<body>
<data id="51">
<list-property name="boundDataColumns">
<structure>
<property name="name">NewParameter</property>
<expression name="expression"
type="javascript">params["NewParameter"]</expression>
<property name="dataType">string</property>
</structure>
</list-property>
<property name="resultSetColumn">NewParameter</property>
</data>
</body>
</report>


On 11/12/2010 6:53 PM, Mike wrote:
> I am creating a report with an input parameter based on a data set. I
> need a combo box to populate based on a query. The datasource is
> scripted and therefore i am using a scripted data set. I have two data
> sets, one for the parameter and the one for the report. I assign the
> data set to the parameter dynamically and set the data set and the field.
>
> The problem is when i run the report the combo box is not getting
> populated. I know the data set works because if i put it on the report i
> get results.
> It is as if the query is not being executed before the parameters window
> comes up.
>
> What do i need to do to have a combo box populate based on a scripted
> data set?
> Thanks
>
Re: Dynamic Parameter with Scripted Data Set [message #638898 is a reply to message #638895] Sat, 13 November 2010 01:23 Go to previous messageGo to next message
Mike S is currently offline Mike S
Messages: 7
Registered: November 2010
Junior Member
I am using birt 2.1.2 for maximo 7.1.1.4.

I tried to copy and paste that XML into a new report but i got XML errors.

Thanks
Re: Dynamic Parameter with Scripted Data Set [message #639210 is a reply to message #638898] Mon, 15 November 2010 15:42 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason Weathersby
Messages: 9167
Registered: July 2009
Senior Member

Mike,

I believe that was a bug in BIRT 2.1.2. It is fixed in later versions
of BIRT.

Jason

On 11/12/2010 8:23 PM, Mike wrote:
> I am using birt 2.1.2 for maximo 7.1.1.4.
>
> I tried to copy and paste that XML into a new report but i got XML errors.
>
> Thanks
Re: Dynamic Parameter with Scripted Data Set [message #730076 is a reply to message #638893] Tue, 27 September 2011 15:16 Go to previous messageGo to next message
Krzysiek  is currently offline Krzysiek
Messages: 9
Registered: August 2010
Junior Member
I've got exactly the same issue
I've got scripted data Source and I try to use it to fetch dynamically into report parameter values list - but the list is empty - I'm pretty sure that my data source work fine cause I could set default value for parameter form it - in this case when I've run the report I've got only one (this) value on the list.
I'm using Birt 2.3.2 - any suggestion how to fix it ?
Re: Dynamic Parameter with Scripted Data Set [message #730099 is a reply to message #730076] Tue, 27 September 2011 15:42 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason Weathersby
Messages: 9167
Registered: July 2009
Senior Member

Can you try it with BIRT 2.6 or 3.7?

Jason

On 9/27/2011 11:16 AM, Krzysiek wrote:
> I've got exactly the same issue I've got scripted data Source and I try
> to use it to fetch dynamically into report parameter values list - but
> the list is empty - I'm pretty sure that my data source work fine cause
> I could set default value for parameter form it - in this case when I've
> run the report I've got only one (this) value on the list.
> I'm using Birt 2.3.2 - any suggestion how to fix it ?
Re: Dynamic Parameter with Scripted Data Set [message #730336 is a reply to message #730099] Wed, 28 September 2011 07:53 Go to previous messageGo to next message
Krzysiek  is currently offline Krzysiek
Messages: 9
Registered: August 2010
Junior Member
I tried 3.7 and it is exactly the same
Here are couple of screenshots:
As I said I'm able to select a default value for the parameter
http://student.agh.edu.pl/~mitrega/1.jpg

But when i run report it look like this:
http://student.agh.edu.pl/~mitrega/2.jpg

and stack trace of the error (unfortunately not whole and as an image Sad )
http://student.agh.edu.pl/~mitrega/3.jpg
Re: Dynamic Parameter with Scripted Data Set [message #730492 is a reply to message #730336] Wed, 28 September 2011 14:11 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason Weathersby
Messages: 9167
Registered: July 2009
Senior Member

I did not see the screenshot. Can you try the attached example?

Jason

On 9/28/2011 3:53 AM, Krzysiek wrote:
> I tried 3.7 and it is exactly the same
> Here are couple of screenshots:
> As I said I'm able to select a default value for the parameter
>
>
> But when i run report it look like this:
>
>
> and stack trace of the error (unfortunately not whole and as an image :( )
>
Re: Dynamic Parameter with Scripted Data Set [message #730534 is a reply to message #730492] Wed, 28 September 2011 15:13 Go to previous messageGo to next message
Krzysiek  is currently offline Krzysiek
Messages: 9
Registered: August 2010
Junior Member
Here are screenshots as attachments
  • Attachment: 1.jpg
    (Size: 99.41KB, Downloaded 148 times)
  • Attachment: 2.jpg
    (Size: 23.76KB, Downloaded 164 times)
  • Attachment: 3.jpg
    (Size: 361.38KB, Downloaded 170 times)
Re: Dynamic Parameter with Scripted Data Set [message #769637 is a reply to message #730534] Thu, 22 December 2011 12:59 Go to previous messageGo to next message
fru Missing name is currently offline fru Missing name
Messages: 6
Registered: December 2011
Junior Member
Hi, problem still exists. Got the same issue with a list not being populated in the parameter dialog using a scripted data set. Im using BIRT 3.7.1
Re: Dynamic Parameter with Scripted Data Set [message #769777 is a reply to message #769637] Thu, 22 December 2011 16:50 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason Weathersby
Messages: 9167
Registered: July 2009
Senior Member

Can you post your report?

Jason

On 12/22/2011 7:59 AM, fru wrote:
> Hi, problem still exists. Got the same issue with a list not being
> populated in the parameter dialog using a scripted data set. Im using
> BIRT 3.7.1
Re: Dynamic Parameter with Scripted Data Set [message #797707 is a reply to message #638893] Mon, 13 February 2012 20:34 Go to previous messageGo to next message
Mike S is currently offline Mike S
Messages: 7
Registered: November 2010
Junior Member
Im back! and having the same issue. Anyone been able to get this working?

Thanks
Mike
Re: Dynamic Parameter with Scripted Data Set [message #805649 is a reply to message #797707] Fri, 24 February 2012 01:36 Go to previous message
andy tan is currently offline andy tan
Messages: 1
Registered: February 2012
Junior Member
I found the solution in another forum in www.birt-exchange.org.

Try adding:

importPackage(Packages.com.ibm.tivoli.maximo.report.script);
mxReportScriptContext = MXReportScriptContext.initialize(reportContext);

to the beforeopen method for each dataset you have. After adding this the combo boxes now work properly.
Previous Topic:Not Getting Sequence order when use 'Y' Optional Grouping
Next Topic:Can't startup the OSGI fr
Goto Forum:
  


Current Time: Wed Sep 17 07:33:13 GMT 2014

Powered by FUDForum. Page generated in 0.13367 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software