Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
PUBLIC CLOUD
PRIVATE CLOUD
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Intelligence (Analytics)
create a variable based select result
thelcd
<p>Hi,</p><p> </p><p>I've got a Report Parameter that I get users to provide.</p><p>I assign this Report Parameter to a variable1 and display it in my Report Design,</p><p> </p><p>I am trying to use that variable1 as input to second query and again assign the result to another variable2. I can only calculate the value of variable2 once the user choses variable1.</p><p> </p><p>I then get my dataset using the 2 variables.</p><p> </p><div>I am having trouble getting the 2nd variable though based on the user input.. </div><div>How can I do this?</div><div> </div>
Find more posts tagged with
Comments
bgbaird
<p>I think this is what your asking....</p><p> </p><p>In the report initialize method:</p><p> </p><p>variable["var1"].value = parameter["param1"].value;</p><p>variable["var2"].value = <something based on var1></p><p> </p><p>Brian</p>
thelcd
<p>yep, I used cascaded parameter groups was also useful..</p>
thelcd
<p>this did exactly what I was looking for.. basically how to assign a paramater a value of a select row result.</p><p>am still left with one issue in how to create a Variable based on the report parameter now.. </p><p>as the variable is assigned at opentime not at run time like the parameter....</p><p><a data-ipb='nomediaparse' href='
http://www.eclipse.org/forums/index.php/t/81150/'>http://www.eclipse.org/forums/index.php/t/81150/</a></p><p>[color=rgb(0,0,0);font-family:Verdana
, Geneva, Lucida, 'Lucida Grande', Arial, Helvetica, sans-serif;font-size:13px;background-color:rgb(244,244,244);]You don't need to make the report parameter an output.[/color]<br />
<br />
[color=rgb(0,0,0);font-family:Verdana, Geneva, Lucida, 'Lucida Grande', Arial, Helvetica, sans-serif;font-size:13px;background-color:rgb(244,244,244);]First create a parameter for your report (not in your dataset, but on your [/color]<br />
[color=rgb(0,0,0);font-family:Verdana, Geneva, Lucida, 'Lucida Grande', Arial, Helvetica, sans-serif;font-size:13px;background-color:rgb(244,244,244);]report, in the Report Parameters section). Say this parameter is called X. [/color]<br />
[color=rgb(0,0,0);font-family:Verdana, Geneva, Lucida, 'Lucida Grande', Arial, Helvetica, sans-serif;font-size:13px;background-color:rgb(244,244,244);]When you create the parameter make sure the "Hidden" checkbox is checked.[/color]<br />
<br />
[color=rgb(0,0,0);font-family:Verdana, Geneva, Lucida, 'Lucida Grande', Arial, Helvetica, sans-serif;font-size:13px;background-color:rgb(244,244,244);]Next, let us assume you have a dataset DS1 which returns a column called [/color]<br />
[color=rgb(0,0,0);font-family:Verdana, Geneva, Lucida, 'Lucida Grande', Arial, Helvetica, sans-serif;font-size:13px;background-color:rgb(244,244,244);]SUM. From your earlier post, it seems like there will be only one value [/color]<br />
[color=rgb(0,0,0);font-family:Verdana, Geneva, Lucida, 'Lucida Grande', Arial, Helvetica, sans-serif;font-size:13px;background-color:rgb(244,244,244);]returned by your dataset i.e., the result will have one column and one row.[/color]<br />
[color=rgb(0,0,0);font-family:Verdana, Geneva, Lucida, 'Lucida Grande', Arial, Helvetica, sans-serif;font-size:13px;background-color:rgb(244,244,244);]In the onFetch method of the dataset DS1, assign the value of this SUM to [/color]<br />
[color=rgb(0,0,0);font-family:Verdana, Geneva, Lucida, 'Lucida Grande', Arial, Helvetica, sans-serif;font-size:13px;background-color:rgb(244,244,244);]the parameter X by typing this code:[/color]<br />
<br />
[color=rgb(0,0,0);font-family:Verdana, Geneva, Lucida, 'Lucida Grande', Arial, Helvetica, sans-serif;font-size:13px;background-color:rgb(244,244,244);]params["X"]=row.["SUM"];[/color]<br />
<br />
[color=rgb(0,0,0);font-family:Verdana, Geneva, Lucida, 'Lucida Grande', Arial, Helvetica, sans-serif;font-size:13px;background-color:rgb(244,244,244);]Now write your query for the second dataset say DS2. The query should be[/color]<br />
[color=rgb(0,0,0);font-family:Verdana, Geneva, Lucida, 'Lucida Grande', Arial, Helvetica, sans-serif;font-size:13px;background-color:rgb(244,244,244);]select <col_names> from <table_name> where <col_name> = ?[/color]<br />
[color=rgb(0,0,0);font-family:Verdana, Geneva, Lucida, 'Lucida Grande', Arial, Helvetica, sans-serif;font-size:13px;background-color:rgb(244,244,244);]Bind the question mark to the parameter X. In order to do that, go to the [/color]<br />
[color=rgb(0,0,0);font-family:Verdana, Geneva, Lucida, 'Lucida Grande', Arial, Helvetica, sans-serif;font-size:13px;background-color:rgb(244,244,244);]parameters in the dataset editor once you have entered the query and select [/color]<br />
[color=rgb(0,0,0);font-family:Verdana, Geneva, Lucida, 'Lucida Grande', Arial, Helvetica, sans-serif;font-size:13px;background-color:rgb(244,244,244);]"X" for the Link to Report Parameter box.[/color]<br />
<br />
[color=rgb(0,0,0);font-family:Verdana, Geneva, Lucida, 'Lucida Grande', Arial, Helvetica, sans-serif;font-size:13px;background-color:rgb(244,244,244);]Now bind DS1 with a blank label and make this invisible. The label should be [/color]<br />
[color=rgb(0,0,0);font-family:Verdana, Geneva, Lucida, 'Lucida Grande', Arial, Helvetica, sans-serif;font-size:13px;background-color:rgb(244,244,244);]placed before the chart. When this element gets loaded, DS1 is called, SUM [/color]<br />
[color=rgb(0,0,0);font-family:Verdana, Geneva, Lucida, 'Lucida Grande', Arial, Helvetica, sans-serif;font-size:13px;background-color:rgb(244,244,244);]is computed and assigned to parameter X. Next when the chart is called which [/color]<br />
[color=rgb(0,0,0);font-family:Verdana, Geneva, Lucida, 'Lucida Grande', Arial, Helvetica, sans-serif;font-size:13px;background-color:rgb(244,244,244);]is bound to DS2, DS2 will use the value of parameter X.[/color]<br />
<br />
[color=rgb(0,0,0);font-family:Verdana, Geneva, Lucida, 'Lucida Grande', Arial, Helvetica, sans-serif;font-size:13px;background-color:rgb(244,244,244);]This way the value from one dataset can be fed to another dataset by using a [/color]<br />
[color=rgb(0,0,0);font-family:Verdana, Geneva, Lucida, 'Lucida Grande', Arial, Helvetica, sans-serif;font-size:13px;background-color:rgb(244,244,244);]parameter that remains hidden.[/color]<br />
[color=rgb(0,0,0);font-family:Verdana, Geneva, Lucida, 'Lucida Grande', Arial, Helvetica, sans-serif;font-size:13px;background-color:rgb(244,244,244);]Though this works, there might be a better way to handle this with your [/color]<br />
[color=rgb(0,0,0);font-family:Verdana, Geneva, Lucida, 'Lucida Grande', Arial, Helvetica, sans-serif;font-size:13px;background-color:rgb(244,244,244);]query.[/color]<br />
<br />
[color=rgb(0,0,0);font-family:Verdana, Geneva, Lucida, 'Lucida Grande', Arial, Helvetica, sans-serif;font-size:13px;background-color:rgb(244,244,244);]-pc[/color]</p>