Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
THRUST SERVICES & TOOLS
CLOUD EDITIONS
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Intelligence (Analytics)
Concat report parameter value in filter
Pujan
I am adding a filter on my report and need to concat the value of 2 report parameters. In the filtration when I build the expression as mentioned below I am getting the following error.
Table (id = 336):
+ The filter definition using expression "row["AGENCY_CLIENT_ID"]" is not valid.
An error happened in data type conversion.
Can not convert the value of NaN to BigDecimal type.
Expression in filter
if(params["ChooseHouseholdMember"].value != '0')
{
params["ChooseHouseholdMember"].value + params["ChoosePrimaryClient"].value
}
else
{
params["ChoosePrimaryClient"].value
}
I tried to use BirtStr.concat as well as Javascript functions but no luck.
Can anyone please help.
Find more posts tagged with
Comments
mwilliams
Hi Pujan,
Can you attach your report design? Maybe that will help. Also, can you expand that error message by clicking on the '+' next to it and post the entire stack in here? What version of BIRT are you using? Thanks.
Pujan
Hello Michael,<br />
<br />
Thanks for the response.<br />
<br />
I was able to concat the 2 report parameter's value using the following code<br />
primaryClients = params["ChoosePrimaryClient"].value;<br />
secondaryClients = params["ChooseHouseholdMember"].value;<br />
str = new Array();<br />
str = str.concat(primaryClients, secondaryClients);<br />
str;<br />
<br />
However - this works when I have value for both parameters since I have used the "IN" operator. But if I have value for "ChoosePrimaryClient" parameter and the "ChooseHouseholdMember" value is "All" then I need to have the filter like <br />
<br />
row[Agency_Client_id] IN params["ChoosePrimaryClient"].value And row[Agency_client_id] LIKE '%' (here % refers to ChooseHouseholdMember param)<br />
<br />
In order to achieve this I tried to dynamically create the filter using the following code in before factory<br />
<br />
if(params["ChooseHouseholdMember"].value[0] == '0')<br />
{<br />
importPackage(Packages.org.eclipse.birt.report.model.api);<br />
importPackage(Packages.org.eclipse.birt.report.model.api.elements);<br />
dshandle = reportContext.getReportRunnable().designHandle.getDesignHandle().findDataSet("AchievementTrackingDataSet");<br />
filters = dshandle.filtersIterator();<br />
while( filters.hasNext() )<br />
{<br />
filterHandle = filters.next();<br />
if( filterHandle.getExpr().indexOf("AGENCY_CLIENT_ID") >= 0 )<br />
{<br />
origOperator = filterHandle.getOperator();<br />
origValue1 = filterHandle.getValue1();<br />
fc = StructureFactory.createFilterCond();<br />
fc.setExpr("dataSetRow["AGENCY_CLIENT_ID"]");<br />
fc.setOperator(origOperator);<br />
fc.setValue1(origValue1);<br />
fc.setOperator(DesignChoiceConstants.FILTER_OPERATOR_LIKE);<br />
params["ChooseHouseholdMember"].value = ' % ';<br />
fc.setValue2(params["ChooseHouseholdMember"].value);<br />
dshandle.removeFilter( filterHandle.getStructure() );<br />
dshandle.addFilter(fc);<br />
}<br />
}<br />
}<br />
<br />
<strong class='bbc'>but I am getting error - <br />
<br />
Table (id = 336): <br />
- An exception occurred during processing. Please see the following message for details:<br />
Invalid Javascript expression: % .<br />
syntax error <br />
exception.error ( 1 time(s) )<br />
detail : org.eclipse.birt.report.engine.api.EngineException: An exception occurred during processing. Please see the following message for details:Invalid Javascript expression: % .syntax error</strong>
Pujan
Hello Michael,
Please find attached the rpt file.
Thanks
Pujan