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)
Dynamic Data Binding By Param
GaidenFocus
<p>How would i use a parameter to determine which row to bind?</p>
<p> </p>
<p>i tried:</p>
<p> </p>
<p></p><pre class="_prettyXprint _linenums:0">row[params["xaxis"].value]
</pre>
<p> </p>
<p>and it did not work. Any help would be greatly appreciated. Merry Christmas!</p>
Find more posts tagged with
Comments
Matthew L.
<p>Could you provide some more explanation on what you are trying to accomplish?</p>
GaidenFocus
<p>Let's say I have a data set with 3 fields I'm binding to the chart. Date, Location, Project. Going into the properties of the chart you would assign either row["Date"], row["Location"], or row["Project"] to the X-Axis. </p>
<p> </p>
<p>What I would like to do is use a parameter value instead. That way I can pass "Date", "Location", or "Project" to BIRT and have it change the X Axis binding.</p>
<p> </p>
<p>I want this dynamic so I'm moving away from a switch / if statement nightmare.</p>
JFreeman
<p>I think you were very close with row[params["xaxis"].value] as I was able to do something very similar to achieve this behavior. I'm guessing the string in your parameter either didn't match exactly to the desired row name or it wasn't uppercase.</p>
<p> </p>
<p>I was able to create this behavior by performing the following:</p>
<p> </p>
<p>I created a second data set with the following query:</p>
<p> </p>
<div style="margin-left:40px;">SELECT COLUMNNAME</div>
<div style="margin-left:40px;">FROM SYS.SYSTABLES, SYS.SYSCOLUMNS </div>
<div style="margin-left:40px;">WHERE TABLEID = REFERENCEID AND TABLENAME = 'ORDERS'</div>
<div style="margin-left:40px;"> </div>
<div>This corresponds to the query in the first data set which is the following:</div>
<div> </div>
<div style="margin-left:40px;">
<div>SELECT *</div>
<div>FROM CLASSICMODELS.ORDERS</div>
</div>
<p> </p>
<p>Therefore my second data set will be a list of all of the possible column names within the first data set. I then created a dynamic list parameter based on the second data set. This parameter will then list all of the possible values which directly correspond to the the first data set.</p>
<p> </p>
<p>I then set the X Series value to: row[params["ParameterName"].value];</p>
<p> </p>
<p>With this configuration the x axis is dynamically set to whatever value is selected form the parameter drop down when the report is run.</p>
<p> </p>
<p>I have attached a sample report using classic models that demonstrates this behavior. This is created using a version 4.2.3 designer.</p>
<p> </p>
<p>Please let me know if you have questions regarding this information or example.</p>
GaidenFocus
<p>Where did you use row[params["ParameterName".value]? I don't see it in the chart props window. I know for sure I am passing the right field name, I've used my PHP logging to see what is being sent. I'm using a view in PHP to get a list of columns; the user can select one.</p>
<p> </p>
<p>EDIT I'm using a query to get column names from the view I'm passing to BIRT</p>
JFreeman
<p>row[params["ParameterName"].value] is being set in Category (X) Series on the Select Data tab of the chart builder.</p>
<p> </p>
<p>In the sample report the value is actually set as "row[params["NewParameter"].value];" but I modified this in the post to ParameterName for readabilities sake. </p>
GaidenFocus
<p>Well I tried it again and it worked. Not sure what was wrong. The only thing I can think of is that it change it to text type instead of DateTime (my PHP will go in the XML and change that if a date type is not selected)</p>
<p> </p>
<p>Thanks for the help! All is well now.</p>