Discussions
Categories
Choose a Product
THRUST SERVICES
CORE APPS
CE PRODUCTS
...
Quick Links
POPULAR
HELPFUL TIPS
Groups
My Links
FOR SIGNED IN MEMBERS:
Back to website
Home
Designing Analytics Reports
URL parameter effect on dataset and other parameters
Migrateduser
<p>Hi all,</p><p> </p><p>I have a little bit complex situation, this is a step by step of what I'm trying to do:</p><p>1. I have a parameter</p><p>2. I use this parameter in an SQL query</p><p>3. I put the query result (from step 2) in to another parameter</p><p> </p><p>for example:</p><p>1. I have a parameter with name = "a";</p><p>2. Then in the query on the "beforeOpen" script I have the following code:</p><pre class="_prettyXprint _lang-js">this.queryText = "SELECT CUSTOMERNAME, CUSTOMERNUMBER FROM CUSTOMERS WHERE CUSTOMERNUMBER = " + params["a"].value;</pre><p>* As you can see I use the value of the parameter "a" (form step 1) in the query</p><p> </p><p>3. I set another parameter:</p><p>name = "b"</p><p>Display type = "List Box"</p><p>Selection list values = "Dynamic"</p><p> </p><p>Then I link it to my data-set (from step 2).</p><p>and I set it's "Select display text" with this code:</p><pre class="_prettyXprint _lang-js">dataSetRow["CUSTOMERNAME"] + "," + dataSetRow["CUSTOMERNUMBER"]</pre><p>* AS you can see it should add all the query rows in to parameter "b"</p><p> </p><p>4. I run a code in the report "initialize" script with the following code:</p><pre class="_prettyXprint _lang-js">var runnable = reportContext.getReportRunnable();var engine = runnable.getReportEngine();var tsk = engine.createGetParameterDefinitionTask( runnable );Customers = new java.util.ArrayList();selectionList = tsk.getSelectionList("b");if (selectionList != null){ for ( var sliter = selectionList.iterator( ); sliter.hasNext( ); ) { var selectionItem = sliter.next( ); Customers.add(""" + selectionItem.getLabel() + """); }}</pre><p>* As you can see this code should go over every row of the "display value" of parameter "b" and each</p><p>row should be added to the "Customers" list.</p><p> </p><p>5. Then I add a text element to the report with the following value:</p><pre class="_prettyXprint _lang-js"><VALUE-OF>Customers</VALUE-OF> </pre><p>* It should display in the report all the values that are in the "Customers" list.</p><p> </p><p> </p><p><strong>The problem:</strong></p><p>If I set parameter "a" value in the designer as it's "Default value" everything work good,</p><p>But if I tried to set it's value by sending it in the URL (For example: &a=103), it doesn't work,</p><p>meaning I get an empty array as parameter "b" (and also as the "Customers" list).</p><p> </p><p>I must be able to send the parameter "a" value through the URL</p><p>Also the reason that I use the second parameter (name = "b") and the list (name= "Customers"), is that I must have a variable that holds <span style="font-size:14px;">all the data that was returned from the query so I will be able to go through it and make some other c</span><span style="font-size:14px;">alculations.</span></p><p> </p><p>I have added a report that init you can see this issue</p><p><strong>For now "a" value is set to "103" and therefore you can run the report and see that "b" gets data.</strong></p><p><strong>Then you can remove "a" values and add "a=103" to the URL and see that "b" becomes an empty array.</strong></p><p> </p><p>Therefore I need 1 of 2 solutions:</p><p>1. Explain to my how can I make birt use the value that I send in the URL for parameter "a" <strong class='bbc'>before </strong>it evaluate </p><p>parameter "b" values.</p><p> </p><p>2. Give me another way to read the dataset results. NOTE that I can't use an hidden table or list in order to do that.</p><p> </p><p>Please help me</p><p>waiting for your reply</p><p>Shlomi</p>
Find more posts tagged with
Comments
There are no comments yet