Home Analytics Designing reports
The community of Analytics developers are invited to follow and participate in the developer network.
OpenText technical experts collaborate with supported customers and partners in the Magellan product area.

Passing multiple parameter values

edited December 31, 1969 in Designing reports
Hi, I've created a sample report to test out the multiple value parameters (Scalar parameter type = Multi Value). I've just used a flatfile datasource with a csv file, and used a filter on my dataset: row["ID"] in params["id"].value

If I use for example: run?__report=test.rpttemplate&id=2&id=3 Then it works fine, but if I try to pass run?__report=test.rpttemplate&id=2,3 then it does not seem to be able to parse the data...

I've tried changing different values in the advanced section of the parameter, but nothing seems to work, if I enter for example 1,2,3 for 'Get default value list', then when previewing the report, it'll only display row 3, the last item of the list and not the others... Shouldn't that work?

Thanks!

Comments

  • mwilliamsmwilliams BIRT Guru
    edited December 31, 1969
    Are you using a multi-select dynamic parameter listbox? Or just a textbox parameter and you're actually entering 1,2,3? I'll make you a simple example. Also, what is your BIRT version?

    Regards,

    Michael Williams

    eSignLive Evangelism & Community Manager | eSignLive by VASCO
     
    Find me on:
    Twitter
    Facebook
    Blog
    LinkedIn

    eSignLive Developer Community
     
    Email me:
    Google: [email protected]

  • edited August 2, 2011
    Thanks for the fast reply! I'm using Birt 3.7. (But actually developing and previewing in 2.6.2 as it's the latest Birt version available 'helios' through the Eclipse updater... :\ I should and will upgrade right away!)

    The parameter is static parameter as the parameter's source isn't really a databaseor a list of values. The parameter values are really passed in the URL, and the URL is dynamically created and contains X number of parameter values depending on the user selection. The dynamic/static are greyed out unless I choose a list box for the display type, but either way I'm not really entering values through the Birt interface, but directly through the URL. Both dynamic/static seem to give the same result though.. (just displaying the last element of the list).
  • mwilliamsmwilliams BIRT Guru
    edited December 31, 1969
    Try something like this as the filter: row["ID"] in params["id"].split(",");

    Regards,

    Michael Williams

    eSignLive Evangelism & Community Manager | eSignLive by VASCO
     
    Find me on:
    Twitter
    Facebook
    Blog
    LinkedIn

    eSignLive Developer Community
     
    Email me:
    Google: [email protected]

  • edited December 31, 1969
    It doesn't seem to be working: If the parameter is a Multi Value, it throws an exception, and if it's Simple Scalar type, it only displays the last parameter value.

    Multi Value error:

    + A BIRT exception occurred. See next exception for more information.
    Error evaluating Javascript expression. Script engine error: Java class "[Ljava.lang.Object;" has no public instance field or method named "split".
    Script source: unnamed script, line: 0, text:
    params["id"].split(",")

    same thing if I do params["id"].value.split(","), no split method for Java object.


    If I add the parameter to my report (drag and drop it like a label on the report itself), if its type is simple scalar text, I will also only see the last value of my parameters (ex: default values = "1,2,3", I will only see 3). If its type is multi value parameter, then the output is java.lang.Object;@e1a690.
  • mwilliamsmwilliams BIRT Guru
    edited December 31, 1969
    I thought your parameter was of type string. If I use a string parameter in BIRT and use this, it works with all values. If you're doing something else, can you set a report up with the sample database how you are doing it and I'll help from there. Thanks.

    Regards,

    Michael Williams

    eSignLive Evangelism & Community Manager | eSignLive by VASCO
     
    Find me on:
    Twitter
    Facebook
    Blog
    LinkedIn

    eSignLive Developer Community
     
    Email me:
    Google: [email protected]

  • mwilliamsmwilliams BIRT Guru
    edited December 31, 1969
    Here's my report I did what I told you above in. You can just edit it to not work how you're doing it and send it back.

    Regards,

    Michael Williams

    eSignLive Evangelism & Community Manager | eSignLive by VASCO
     
    Find me on:
    Twitter
    Facebook
    Blog
    LinkedIn

    eSignLive Developer Community
     
    Email me:
    Google: [email protected]

  • edited August 2, 2011
    Thanks your report works! And mine does too now... It was really a preview problem:

    I tried to find differences between yours and mine and one of the differences was that my parameter was hidden. I had put a default value and kept changing it but the preview report never seemed to change...

    I removed the 'hidden' attribute, launched the preview, it prompted me to enter some values, which I did, and from there on, the preview report worked and displayed the values manually entered! I put back hidden, changed the default values, and the values displayed in the preview were always the values entered manually in the parameter window of the preview. Changing default values did not change the preview at all...

    So that was the problem... I must have entered a single value at one point when launching the preview, and instead of using the changed default values, it just used this old value after adding the split()..

    Even closing the report, closing Birt Report Designer, the last manually entered value is used instead of default... Birt creates a .rptconfig file it seems which contains them. Even if I delete this file, have the param as hidden, it won't use the default values! And in this case, it always displays one row...

    Easily reproduced the problem with your report:
    1) change the default paramater value to 3,4,5 and put the parameter to hidden
    2) close the report, delete the .rptconfig file
    3) open and preview the report.

    It then never uses the default value... Actually, in my case, it used the value '4', I have no idea where it gets this number, I can enter anything in default, it only displays row with id '4'...

    Anyhow, preview problem aside, the split with the text parameter seems to work great! Thanks a lot! You're always great help!
  • edited December 31, 1969
    <blockquote class='ipsBlockquote' data-author="'mwilliams'" data-cid="80941" data-time="1312302937" data-date="02 August 2011 - 09:35 AM"><p>
    I thought your parameter was of type string. If I use a string parameter in BIRT and use this, it works with all values. If you're doing something else, can you set a report up with the sample database how you are doing it and I'll help from there. Thanks.<br /></p></blockquote>
    <br />
    Hi,<br />
    <br />
    I have similar problem. I have a paramter X (data type: string, display type: list box, multiple values allowed), which is the last paramter in a cascading paramter group. I would like to filter a data set using this parameter. All rows, where a column value Y is not in the list of paramter X should be filtered out.<br />
    <br />
    I tried several filters without success.<br />
    <br />
    row["Y"] Not In params["X"].value <br />
    <br />
    BirtComp.anyOf(row["Y"],params["X"].value) is True<br />
    <br />
    Only the first value in the parameter list X is taken.<br />
    <br />
    What do I do wrong?<br />
    <br />
    Kind regards,<br />
    <br />
    /stephan
  • mwilliamsmwilliams BIRT Guru
    edited December 31, 1969
    Stephan,

    So, you're wanting to use the multi-select parameter value in a filter on a dataSet? You're not wanting to use the parameter in the query? Is this correct? What is your BIRT version?

    Regards,

    Michael Williams

    eSignLive Evangelism & Community Manager | eSignLive by VASCO
     
    Find me on:
    Twitter
    Facebook
    Blog
    LinkedIn

    eSignLive Developer Community
     
    Email me:
    Google: [email protected]

  • edited December 31, 1969
    <blockquote class='ipsBlockquote' data-author="'mwilliams'" data-cid="94696" data-time="1327689009" data-date="27 January 2012 - 11:30 AM"><p>
    Stephan,<br />
    <br />
    So, you're wanting to use the multi-select parameter value in a filter on a dataSet? You're not wanting to use the parameter in the query? Is this correct? What is your BIRT version?<br /></p></blockquote>
    <br />
    Yes, this is correct. I want to use a multi-select paramater it in a filter on the data set. I'm using BIRT Framework 3.7.1.v20110905-BDF9E8OGTzuHfoz-Au7-CWvXDn6N.
  • mwilliamsmwilliams BIRT Guru
    edited December 31, 1969
    If I use a filter like, row["Y"] Not In params["X"].value, on my dataSet, it works for me in BIRT 3.7.1. Can you reproduce your issue with the sample database and attach the report in here?

    Regards,

    Michael Williams

    eSignLive Evangelism & Community Manager | eSignLive by VASCO
     
    Find me on:
    Twitter
    Facebook
    Blog
    LinkedIn

    eSignLive Developer Community
     
    Email me:
    Google: [email protected]

  • <blockquote class="ipsBlockquote" data-author="mwilliams" data-cid="80942" data-time="1312303089"><div><p>Here's my report I did what I told you above in. You can just edit it to not work how you're doing it and send it back.</p></div></blockquote><p>Hi Micheal, I have the same problem but I don't see your example report.</p><p>Please send me if you can.</p><p> </p><p>Regard,</p><p>William</p>
  • edited March 6, 2014
    <p>Hello All:</p><p> </p><p>I am using 3.7.1 RCP and I encountered the same issue when trying to pass a dynamic parameter with multiple selections.  Please bear with me, I am also a BIRT Newbie and this is my first time seeing this issue.  </p><p> </p><p>My dataset is a list of login names (Employee ID) and when I try to implement this solution with in the data binding formula editor:</p><p>row["EMPLOYEE_ID"] in params["Employee ID"].split(",");</p><p> </p><p>I receive the error:</p><div>Data (id = 1369):</div><div><span>+ </span>A BIRT exception occurred. See next exception for more information.
    Error evaluating Javascript expression. Script engine error: Java class "[Ljava.lang.Object;" has no public instance field or method named "split".
     Script source: null, line: 0, text:
     </div><div><compiled script> (Element ID:1369) data.engine.BirtException ( 1 time(s) )
    detail : org.eclipse.birt.report.engine.api.EngineException: A BIRT exception occurred. See next exception for more information.
    Error evaluating Javascript expression. Script engine error: Java class "[Ljava.lang.Object;" has no public instance field or method named "split".
    Script source: null, line: 0, text:
    <compiled script> (Element ID:1369)
    at org.eclipse.birt.report.engine.executor.ExecutionContext.addException(ExecutionContext.java:1214)
    at org.eclipse.birt.report.engine.executor.ExecutionContext.addException(ExecutionContext.java:1193)
    at org.eclipse.birt.report.engine.executor.DataItemExecutor.execute(DataItemExecutor.java:101)
    at org.eclipse.birt.report.engine.internal.executor.dup.SuppressDuplicateItemExecutor.execute(SuppressDuplicateItemExecutor.java:43)
    at org.eclipse.birt.report.engine.internal.executor.wrap.WrappedReportItemExecutor.execute(WrappedReportItemExecutor.java:46)
    at org.eclipse.birt.report.engine.internal.executor.l18n.LocalizedReportItemExecutor.execute(LocalizedReportItemExecutor.java:34)
    at org.eclipse.birt.report.engine.layout.html.HTMLAbstractLM.execute(HTMLAbstractLM.java:468)
    at org.eclipse.birt.report.engine.layout.html.HTMLAbstractLM.execute(HTMLAbstractLM.java:476)
    at org.eclipse.birt.report.engine.layout.html.HTMLAbstractLM.execute(HTMLAbstractLM.java:476)
    at org.eclipse.birt.report.engine.layout.html.HTMLAbstractLM.execute(HTMLAbstractLM.java:476)
    at org.eclipse.birt.report.engine.layout.html.HTMLAbstractLM.execute(HTMLAbstractLM.java:476)
    at org.eclipse.birt.report.engine.layout.html.HTMLAbstractLM.execute(HTMLAbstractLM.java:476)
    at org.eclipse.birt.report.engine.layout.html.HTMLListingBandLM.intializeHeaderContent(HTMLListingBandLM.java:98)
    at org.eclipse.birt.report.engine.layout.html.HTMLListingBandLM.initialize(HTMLListingBandLM.java:50)
    at org.eclipse.birt.report.engine.layout.html.HTMLTableBandLM.initialize(HTMLTableBandLM.java:44)
    at org.eclipse.birt.report.engine.layout.html.HTMLLayoutManagerFactory.createLayoutManager(HTMLLayoutManagerFactory.java:40)
    at org.eclipse.birt.report.engine.layout.html.HTMLReportLayoutEngine.createLayoutManager(HTMLReportLayoutEngine.java:138)
    at org.eclipse.birt.report.engine.layout.html.HTMLBlockStackingLM.layoutNodes(HTMLBlockStackingLM.java:68)
    at org.eclipse.birt.report.engine.layout.html.HTMLStackingLM.layoutChildren(HTMLStackingLM.java:26)
    at org.eclipse.birt.report.engine.layout.html.HTMLTableLM.layoutChildren(HTMLTableLM.java:132)
    at org.eclipse.birt.report.engine.layout.html.HTMLAbstractLM.layout(HTMLAbstractLM.java:140)
    at org.eclipse.birt.report.engine.layout.html.HTMLBlockStackingLM.layoutNodes(HTMLBlockStackingLM.java:70)
    at org.eclipse.birt.report.engine.layout.html.HTMLStackingLM.layoutChildren(HTMLStackingLM.java:26)
    at org.eclipse.birt.report.engine.layout.html.HTMLAbstractLM.layout(HTMLAbstractLM.java:140)
    at org.eclipse.birt.report.engine.layout.html.HTMLInlineStackingLM.resumeLayout(HTMLInlineStackingLM.java:111)
    at org.eclipse.birt.report.engine.layout.html.HTMLInlineStackingLM.layoutNodes(HTMLInlineStackingLM.java:160)
    at org.eclipse.birt.report.engine.layout.html.HTMLStackingLM.layoutChildren(HTMLStackingLM.java:26)
    at org.eclipse.birt.report.engine.layout.html.HTMLAbstractLM.layout(HTMLAbstractLM.java:140)
    at org.eclipse.birt.report.engine.layout.html.HTMLBlockStackingLM.layoutNodes(HTMLBlockStackingLM.java:70)
    at org.eclipse.birt.report.engine.layout.html.HTMLStackingLM.layoutChildren(HTMLStackingLM.java:26)
    at org.eclipse.birt.report.engine.layout.html.HTMLTableLM.layoutChildren(HTMLTableLM.java:132)
    at org.eclipse.birt.report.engine.layout.html.HTMLAbstractLM.layout(HTMLAbstractLM.java:140)
    at org.eclipse.birt.report.engine.layout.html.HTMLBlockStackingLM.layoutNodes(HTMLBlockStackingLM.java:70)
    at org.eclipse.birt.report.engine.layout.html.HTMLPageLM.layout(HTMLPageLM.java:92)
    at org.eclipse.birt.report.engine.layout.html.HTMLReportLayoutEngine.layout(HTMLReportLayoutEngine.java:100)
    at org.eclipse.birt.report.engine.api.impl.RunAndRenderTask.doRun(RunAndRenderTask.java:180)
    at org.eclipse.birt.report.engine.api.impl.RunAndRenderTask.run(RunAndRenderTask.java:77)
    at org.eclipse.birt.report.service.ReportEngineService.runAndRenderReport(ReportEngineService.java:929)
    at org.eclipse.birt.report.service.BirtViewerReportService.runAndRenderReport(BirtViewerReportService.java:973)
    at org.eclipse.birt.report.service.actionhandler.BirtGetPageAllActionHandler.__execute(BirtGetPageAllActionHandler.java:131)
    at org.eclipse.birt.report.service.actionhandler.AbstractBaseActionHandler.execute(AbstractBaseActionHandler.java:90)
    at org.eclipse.birt.report.soapengine.processor.AbstractBaseDocumentProcessor.__executeAction(AbstractBaseDocumentProcessor.java:47)
    at org.eclipse.birt.report.soapengine.processor.AbstractBaseComponentProcessor.executeAction(AbstractBaseComponentProcessor.java:143)
    at org.eclipse.birt.report.soapengine.processor.BirtDocumentProcessor.handleGetPageAll(BirtDocumentProcessor.java:183)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.eclipse.birt.report.soapengine.processor.AbstractBaseComponentProcessor.process(AbstractBaseComponentProcessor.java:112)
    at org.eclipse.birt.report.soapengine.endpoint.BirtSoapBindingImpl.getUpdatedObjects(BirtSoapBindingImpl.java:66)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.apache.axis.providers.java.RPCProvider.invokeMethod(RPCProvider.java:397)
    at org.apache.axis.providers.java.RPCProvider.processMessage(RPCProvider.java:186)
    at org.apache.axis.providers.java.JavaProvider.invoke(JavaProvider.java:323)
    at org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrategy.java:32)
    at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:118)
    at org.apache.axis.SimpleChain.invoke(SimpleChain.java:83)
    at org.apache.axis.handlers.soap.SOAPService.invoke(SOAPService.java:454)
    at org.apache.axis.server.AxisServer.invoke(AxisServer.java:281)
    at org.apache.axis.transport.http.AxisServlet.doPost(AxisServlet.java:699)
    at org.eclipse.birt.report.servlet.BirtSoapMessageDispatcherServlet.doPost(BirtSoapMessageDispatcherServlet.java:265)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
    at org.apache.axis.transport.http.AxisServletBase.service(AxisServletBase.java:327)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
    at org.eclipse.birt.report.servlet.BirtSoapMessageDispatcherServlet.service(BirtSoapMessageDispatcherServlet.java:122)
    at org.eclipse.equinox.http.registry.internal.ServletManager$ServletWrapper.service(ServletManager.java:180)
    at org.eclipse.equinox.http.servlet.internal.ServletRegistration.service(ServletRegistration.java:61)
    at org.eclipse.equinox.http.servlet.internal.ProxyServlet.processAlias(ProxyServlet.java:126)
    at org.eclipse.equinox.http.servlet.internal.ProxyServlet.service(ProxyServlet.java:60)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
    at org.eclipse.equinox.http.jetty.internal.HttpServerManager$InternalHttpServiceServlet.service(HttpServerManager.java:317)
    at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:511)
    at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:390)
    at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182)
    at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:765)
    at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
    at org.mortbay.jetty.Server.handle(Server.java:326)
    at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:542)
    at org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:939)
    at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:756)
    at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:212)
    at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404)
    at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:409)
    at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:582)
    Caused by: org.eclipse.birt.data.engine.core.DataException: A BIRT exception occurred. See next exception for more information.
    Error evaluating Javascript expression. Script engine error: Java class "[Ljava.lang.Object;" has no public instance field or method named "split".
    Script source: null, line: 0, text:
    <compiled script>
    at org.eclipse.birt.data.engine.core.DataException.wrap(DataException.java:123)
    at org.eclipse.birt.data.engine.expression.BytecodeExpression.evaluate(BytecodeExpression.java:54)
    at org.eclipse.birt.data.engine.expression.ExprEvaluateUtil.evaluateCompiledExpression(ExprEvaluateUtil.java:205)
    at org.eclipse.birt.data.engine.expression.ExprEvaluateUtil.evaluateCompiledExpression(ExprEvaluateUtil.java:219)
    at org.eclipse.birt.data.engine.expression.ExprEvaluateUtil.evaluateExpression(ExprEvaluateUtil.java:76)
    at org.eclipse.birt.data.engine.impl.BindingColumnsEvalUtil.evaluateValue(BindingColumnsEvalUtil.java:201)
    at org.eclipse.birt.data.engine.impl.BindingColumnsEvalUtil.evaluateValue(BindingColumnsEvalUtil.java:237)
    at org.eclipse.birt.data.engine.impl.ResultIterator.prepareBindingColumn(ResultIterator.java:733)
    at org.eclipse.birt.data.engine.impl.ResultIterator.getValue(ResultIterator.java:710)
    at org.eclipse.birt.report.engine.data.dte.QueryResultSet.getValue(QueryResultSet.java:403)
    at org.eclipse.birt.report.engine.executor.DataItemExecutor.execute(DataItemExecutor.java:97)
    ... 84 more
    Caused by: org.eclipse.birt.core.exception.CoreException: Error evaluating Javascript expression. Script engine error: Java class "[Ljava.lang.Object;" has no public instance field or method named "split".
    Script source: null, line: 0, text:
    <compiled script>
    at org.eclipse.birt.core.script.JavascriptEvalUtil.wrapRhinoException(JavascriptEvalUtil.java:303)
    at org.eclipse.birt.data.engine.expression.BytecodeExpression.evaluate(BytecodeExpression.java:55)
    ... 93 more
    Caused by: org.mozilla.javascript.EvaluatorException: Java class "[Ljava.lang.Object;" has no public instance field or method named "split".
    at org.mozilla.javascript.DefaultErrorReporter.runtimeError(DefaultErrorReporter.java:109)
    at org.mozilla.javascript.Context.reportRuntimeError(Context.java:938)
    at org.mozilla.javascript.Context.reportRuntimeError(Context.java:994)
    at org.mozilla.javascript.Context.reportRuntimeError2(Context.java:964)
    at org.mozilla.javascript.NativeJavaArray.get(NativeJavaArray.java:103)
    at org.eclipse.birt.core.script.ScriptableParameter.get(ScriptableParameter.java:65)
    at org.mozilla.javascript.ScriptableObject.getProperty(ScriptableObject.java:1617)
    at org.mozilla.javascript.ScriptRuntime.getPropFunctionAndThisHelper(ScriptRuntime.java:2227)
    at org.mozilla.javascript.ScriptRuntime.getPropFunctionAndThis(ScriptRuntime.java:2214)
    at org.mozilla.javascript.Interpreter.interpretLoop(Interpreter.java:3143)
    at org.mozilla.javascript.Interpreter.interpret(Interpreter.java:2487)
    at org.mozilla.javascript.InterpretedFunction.call(InterpretedFunction.java:164)
    at org.mozilla.javascript.SecurityController$1.exec(SecurityController.java:193)
    at org.eclipse.birt.report.engine.javascript.ScriptUtil$1.execWithDomain(ScriptUtil.java:59)
    at org.mozilla.javascript.SecurityController.callWithDomain(SecurityController.java:189)
    at org.mozilla.javascript.Interpreter.interpret(Interpreter.java:2474)
    at org.mozilla.javascript.InterpretedFunction.call(InterpretedFunction.java:164)
    at org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:398)
    at org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:3065)
    at org.mozilla.javascript.InterpretedFunction.exec(InterpretedFunction.java:175)
    at org.eclipse.birt.data.engine.expression.BytecodeExpression.evaluate(BytecodeExpression.java:49)
    ... 93 more
     </div><div>May I ask to see the rptdesign file for an example?   Thanks for all your help. :)</div><div> </div><div>Thanks,</div><div>Benny</div>
  • kclarkkclark BIRT Guru EM
    <p>@bliem -- It's saying that split() isn't available because the multiselect parameter is returning as an object, not a string.  You could try doing something like this.</p><pre class="_prettyXprint _lang-">var customers = params["customers"].toString();var customerArray = new Array();customerArray = customers.split(",");</pre>

    Kristopher Clark

    Actuate Corporation – The BIRT Company™

    http://www.actuate.com | http://birtondemand.com

     

    My Blog

    Twitter

    LinkedIn
    Facebook
     

  • <p>@kclark Thank you.  I was able to have the field display the multiple employee IDs selected from the dynamic parameter using the the toString Function.    However, my report only displays data from my first selection only and does not include the second value .  For example, I select Bob and Joe within the parameter, only data for Bob displays.  </p><p> </p><p>My Dataset has a filter:</p><p>row ["Employee ID"] IN params["Employee ID"].value</p><p> </p><p>Am I missing something?  </p><p> </p><p>Thanks again. </p>
  • kclarkkclark BIRT Guru EM
    <p>Can you recreate this with Classic Models and post the rptdesign?</p>

    Kristopher Clark

    Actuate Corporation – The BIRT Company™

    http://www.actuate.com | http://birtondemand.com

     

    My Blog

    Twitter

    LinkedIn
    Facebook
     

  • <p>hey, i also have multiple value parameter but acc to my requirement i have to execute query by one parameter one by one which is working but its not fetching data </p><p>See in Open</p><div>importPackage(Packages.com.infomro.reporting.events);</div><div> </div><div>var plantNo = params["appContextPlant"].value;</div><div>//var reqNo = params["req_No"].value;</div><div>var reqArray  = [];</div><div>reqArray = params["req_No"].value.split(",");</div><div> </div><div>for(var i=0;i<reqArray.length;i++){</div><div>poreEvents = new StdPoreReqEvents();</div><div>poreEvents.setReqNo(reqArray);</div><div>poreEvents.setPlantNo(plantNo);</div><div>}</div><div>poreEvents.open();</div><div> </div><div> </div><div>which executes query but not fetching its data. how to do this</div><div>??</div>
  • <p>Hi Williams,</p>
    <p> </p>
    <p>After going through several posts related to passing multiple values on a single parameter, i wrote my sql in the BIRT dataset as <span style="color:#ff0000;">select m.country,tp.categoryLev1 ,tp.categoryLev2,m.sentiment,<br>
    (case when m.sentiment=1 then 'S1' when m.sentiment=2 then 'S2'<br>
    when m.sentiment=3 then 'S3' when m.sentiment=4 then 'S4' end) as rating<br>
    from mentionmysql.topic tp<br>
    join mentionmysql.master m on m._id=tp._id<br>
    where m.Country like ? and </span><span style="color:#0000ff;">tp.categoryLev1 IN ('****')</span><br><span style="color:#ff0000;">and m.MentionCreatedDate between str_to_date(?,'%d/%m/%Y') and str_to_date(?,'%d/%m/%Y');</span><br>
    and wrote the script for before open for the same dataset as ,</p>
    <p> </p>
    <p><span style="color:#ff0000;">this.queryText = this.queryText.replace("****", params["CategoryLev1"].value.join(","));</span></p>
    <p> </p>
    <p>Yet i did not get any positive result.</p>
    <p>FYI I use spagobi studio (Eclipse Platform Version: Luna SR2 (4.4.2)) for creating BIRT report.</p>
    <p> </p>
    <p>My parameter name is <span style="color:#0000ff;">CategoryLev1</span>. All parameters are defined as text box so that I can configure these parameters as list box on spagobi server. Please inform me as it is very urgent. FYI i need to pass characters as multiple values (for eg: 'Products','Terms','Parts',....) and not id's. Even i tried your sample report "TestReport.rpt" but it is not working for strings.</p>
    <p> </p>
    <p>can anyone help me out. Thanks</p>
  • <p>Hello i wanted to create a parameter where i can input multiple values where seperated by " , " is it possible? i try it under Filter and it works well but if i try it in parameter it doesnt work , any idea ? please help " params["Parameter"].<span style="color:rgb(40,40,40);font-family:'Source Sans Pro', sans-serif;">split(",");  " </span></p>
  • @zer0 said:
    Hello i wanted to create a parameter where i can input multiple values where seperated by " , " is it possible? i try it under Filter and it works well but if i try it in parameter it doesnt work , any idea ? please help " params["Parameter"].split(",");  " 

    Did you find any solution to this??
    I need to do the same

  • @LeleTheBest said:

    @zer0 said:
    Hello i wanted to create a parameter where i can input multiple values where seperated by " , " is it possible? i try it under Filter and it works well but if i try it in parameter it doesnt work , any idea ? please help " params["Parameter"].split(",");  " 

    Did you find any solution to this??
    I need to do the same

    Here is a way we found to do it (this goes in the beforeOpen script of the data set):

    if (params["poNum"].value != null)
    {var newstring = params["poNum"].value
    var newstring2 = newstring.replace(/,/gi, "','")
    var newstring3 = newstring2.replace(/',' /gi, "','")
    this.queryText = this.queryText + " AND po.ponum in ('"+newstring3+"') ";}

    Hope this helps.

  • @CodeRookie said:

    @LeleTheBest said:

    @zer0 said:
    Hello i wanted to create a parameter where i can input multiple values where seperated by " , " is it possible? i try it under Filter and it works well but if i try it in parameter it doesnt work , any idea ? please help " params["Parameter"].split(",");  " 

    Did you find any solution to this??
    I need to do the same

    Here is a way we found to do it (this goes in the beforeOpen script of the data set):

    if (params["poNum"].value != null)
    {var newstring = params["poNum"].value
    var newstring2 = newstring.replace(/,/gi, "','")
    var newstring3 = newstring2.replace(/',' /gi, "','")
    this.queryText = this.queryText + " AND po.ponum in ('"+newstring3+"') ";}

    Hope this helps.

    I'd like to use it as an array, i need to put it into an "IN" clause for making a query on the db.

    I wrote this in the beforeOpen:
    `
    if(params["PARAM_NAME"].value != null && params["PARAM_NAME"].value != "") {
    // var tempArray = params["PARAM_NAME"].split(";");
    var tempArray = params["PARAM_NAME"].value.split(";");

    for(var i=0; i<tempArray.length; i++)
    {
        tempArray[i];   
    }
    
    
    query = query + " AND VALUE IN (" + tempArray[0] + ", " + tempArray[1] + ", " + tempArray[2] + ", " + tempArray[3] + ", " + tempArray[4] + ", " + tempArray[5] + ", " + tempArray[6] +")";
    

    }
    `

    Is better to use the .value.split or only the .split?
    I think it's the same :-)

    I need to catch the 7 values that the user can insert in a text-box as a parameter.
    ex. "S01;S02;S03" etc.

    But, what happens if the user doesn't insert all the 7 values (string) separated by ; ?

    Thanks for the help! @CodeRookie

  • Here's my solution:

    `
    if(params["C_UNIT_CODE"].value != null && params["C_UNIT_CODE"].value != "") {

    var tempArray = (params["C_UNIT_CODE"].value).split(";");
    var str = [];
    
    query = query + " AND GT.C_UNIT_CODE IN (";
    
    for(var i=0; i<tempArray.length; i++)
    {
        str[i] = "'" + tempArray[i] + "'";
    }
    
    query = query + str.join(", ");
    query = query + ")";
    

    }
    `

    I hope this helps! :smile:

Sign In or Register to comment.