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)
Assign (report?) variable from data set
GoranG
Hi people.<br />
<br />
being new to BIRT makes my head spin. In opposite direction of the Earth's spinning. <br />
I tried to find a solution on this forum already, but couldn't find one. If I missed such topic, please, re-direct me to it. <br />
<br />
I'm using BIRT 2.5.2, and I'm connected to MSSQL DB.<br />
The query (data set) I have prepared gives me following result (as seen in "Preview Results"):<br />
oid version parameterName registeredParameterType parameterValueString batchExecution_oid <br />
1 0 Interval from DATE 01.01.2010 1 <br />
2 0 Interval until DATE 01.01.2011 1 <br />
3 0 Financial security STRING % 1 <br />
4 0 Execution date from DATE 01.01.2010 1 <br />
5 0 Execution date until DATE 01.01.2011 1 <br />
6 0 Contract number STRING % 1 <br />
7 0 Portfolio Group STRING % 1 <br />
8 0 Coverage Part Notation STRING % 1 <br />
<br />
Now, I need to extract a value with "parameter name" == "Interval from" to be re-used all over report again and again. And similar for other results.<br />
My idea was to assign these values to a report variable. (maybe you'll suggest another solutions, which is quite OK).<br />
So I added a dynamic text with binding to this data set to the beginning of the report. The code says:<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>if(row["parameterName"] == 'Interval from') { vars["intervalFrom"] = row["parameterValueString"]}</pre>
The dynamic text is set to "No Display". <br />
And it works.<br />
But then I tried to do the same for other values. E.g.<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>if(row["parameterName"] == 'Interval until') { vars["intervalUntil"] = row["parameterValueString"] }</pre>
Here, I get a result <strong class='bbc'>null</strong>.<br />
For <pre class='_prettyXprint _lang-auto _linenums:0'>if(row["parameterName"]=='Financial security') {vars["financialSecurity"] = row["parameterValueString"]}</pre> I get an empty string as a result. Maybe it is not even an empty string, I just don't see anything printed (cannot compare it with == "", so I can't play with it).<br />
<br />
I'm doing something terrible wrong. Please help me find a right way to do this!<br />
<br />
cheers,<br />
G
Find more posts tagged with
Comments
GoranG
found a solution.
Dynamic text does not iterate over data set. That is why only the first expression was correctly evaluated.
If I do this in the table then it works.
Of course, the table is the construct that really iterates over all result set.
Yes, i'm a newbie.
cheers,
G
mwilliams
Hi G,
Glad you figured it out. If you ever don't find what you're looking for in a quick search of the devShare or forums, please feel free to ask!