| Summary: | Can't specify multiple values for a parameter in viewer tag library | ||
|---|---|---|---|
| Product: | z_Archived | Reporter: | John MG <muirhejs> |
| Component: | BIRT | Assignee: | Vincent Petry <vpetry> |
| Status: | VERIFIED FIXED | QA Contact: | Xiaodan Wang <xwang> |
| Severity: | enhancement | ||
| Priority: | P3 | CC: | bluesoldier, pvolchek, skandyinwonderland, vpetry, zqian |
| Version: | unspecified | Keywords: | plan |
| Target Milestone: | 2.3.2 | ||
| Hardware: | All | ||
| OS: | Windows XP | ||
| Whiteboard: | Non-Auto | ||
You can try passing a Java array directly this way:
<birt:param name="customerNames" value="<%= new String[] {"value1","value2"} %>" />
You can use this as a workaround.
Since it is not very clean to require the user to use JSP scriptlets, we will add a new value tag that will allow to specify multiple values this way:
<birt:param name="customerNames">
<birt:value>value1</birt:value>
<birt:value>value2</birt:value>
<birt:value>value3</birt:value>
</birt:param>
This works great!! Thanks! I am generating the report using the command line and passing the parameter file as an option: When I pass a single value to a parameter, my parameter file looks like that: my.param value=45 How do I modify the value, so that I could pass an array there? It would be nice if Birt could automatically convert passed values to an array, when the parameter has an array type. For example, if both value1 and value2 are parameters that accept multiple values, then when Birt encounters the foolowing values it would threat them as an array, even though the first value is a single parameter only my.param value1=45 value2=45,56,78 (In reply to comment #3) > I am generating the report using the command line and passing the parameter > file as an option: > > When I pass a single value to a parameter, my parameter file looks like that: > > my.param > value=45 > > How do I modify the value, so that I could pass an array there? > It would be nice if Birt could automatically convert passed values to an array, > when the parameter has an array type. > For example, if both value1 and value2 are parameters that accept multiple > values, then when Birt encounters the foolowing values it would threat them as > an array, even though the first value is a single parameter only > > my.param > value1=45 > value2=45,56,78 > Your issue is not related to taglib, please file a separate bug using the "Engine" component. It's now possible to specify multiple values, in different ways:
1) <birt:param name="customerNames" value="Cust1,Cust2" delim="," /> where the delim attribute specifies the delimiter (defaults to pipe "|")
2) <birt:param name="customerNames">
<birt:value value="Cust1" />
<birt:value value="Cust2" />
</birt:param>
3) <birt:param name="customerNames">
<birt:value>Cust1</birt:value>
<birt:value>Cust2</birt:value>
</birt:param>
4) The scriptlet way still works:
<birt:param name="customerNames" value="<%= new String[] {"Cust1","Cust2"}
%>" />
Verified in build (2.3.2.v20081218-0730) and build (2.5.0.v20081218-0630). Hi, i'm using the code below to set values for a multiple values parameter "testMultiValuesParam" If i create the parameter "testMultiValuesParam" in my report as a Listbox and allow multiple values params["testMultiValuesParam"].value is always null ! (I've tried static and dynamic values from dataset when defining the report parameter) I've tried with the same code defining the parameter as a textbox (single value), params["testMultiValuesParam"].value returns the first value defined in the tag lib ( it returns Cust1 ) <birt:viewer id="birtViewer" pattern="run" showToolBar="false" showNavigationBar="false" showTitle="false" reportDesign="test.rptdesign" height="768" width="1024" format="html" > <birtaram name="testMultiValuesParam"> <birt:value>Cust1</birt:value> <birt:value>Cust2</birt:value> </birtaram> </birt:viewer> BIRT 2.3.2.r232_20090202 Build <2.3.2.v20090218-0730> (both designer and engine) Thank you for helping. BUG reported here : https://bugs.eclipse.org/bugs/show_bug.cgi?id=272306 (In reply to comment #7) > Hi, > > i'm using the code below to set values for a multiple values parameter > "testMultiValuesParam" > > If i create the parameter "testMultiValuesParam" in my report as a Listbox and > allow multiple values params["testMultiValuesParam"].value is always null ! > (I've tried static and dynamic values from dataset when defining the report > parameter) > > I've tried with the same code defining the parameter as a textbox (single > value), params["testMultiValuesParam"].value returns the first value defined in > the tag lib ( it returns Cust1 ) > > <birt:viewer id="birtViewer" pattern="run" showToolBar="false" > showNavigationBar="false" showTitle="false" reportDesign="test.rptdesign" > height="768" > width="1024" > format="html" > > > > <birtaram name="testMultiValuesParam"> > <birt:value>Cust1</birt:value> > <birt:value>Cust2</birt:value> > </birtaram> > > </birt:viewer> > > BIRT 2.3.2.r232_20090202 Build <2.3.2.v20090218-0730> (both designer and > engine) > > Thank you for helping. > |
I have a parameter that accepts multiple values via listbox; i would like to be able to provide the data to the report viewer from the tag library: One could probably specify the "value" for the birt:param a few different ways, but I have not yet found a way that works: Ex: <birt:report id="birtViewer" reportDesign="report/param_4.rptdesign" height="600" width="800" format="html" reportContainer="div" isHostPage="false" > <birt:param name="customerNames" value="Cust1"></birt:param> <birt:param name="customerNames" value="Cust2></birt:param> </birt:report> </body> </html> OR: <birt:param name="customerNames" value="{'Cust1','Cust2'}"></birt:param>