Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
THRUST SERVICES & TOOLS
CLOUD EDITIONS
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Intelligence (Analytics)
variable during list rendering
hq4ever
Hello,
Being a new BIRT, I'm trying to think like I was thinking in Jasper...
I have a list, based on a dataaset.
I would like to define a variable on each "iteration" of the list, this variable is a result of a java based calculation which (for the sake of example) will be displayed using different format on various rows in the list.
I understand that I need to define a javascript event, and a javascript variable.
But on what object?
On what event?
How do I define the variable (type?)
How do I use it?
Thank you,
Maxim.
Find more posts tagged with
Comments
mwilliams
Hi Maxim,
Can you explain a little bit more about what you're looking for?
hq4ever
<blockquote class='ipsBlockquote' data-author="mwilliams"><p>Hi Maxim,<br />
<br />
Can you explain a little bit more about what you're looking for?</p></blockquote>
<br />
Hello mwilliams,<br />
<br />
Assuming I have a DB table that contains <br />
| col1 | col2 |<br />
| A | 1 |<br />
| B | 2 |<br />
<br />
A list object would display this as <br />
<br />
Name : A<br />
Value : 1<br />
<br />
Name : B<br />
Value : 2<br />
<br />
<br />
Lets assume that I want instead of "value : 1" to do a heavy calculation, based on the input value (1), I call BigCalc.heavyCalc(1) and get back a Result and store it in a variable <pre class='_prettyXprint _lang-auto _linenums:0'>resultVar = BigCalc.heavyCalc(1);</pre>
<br />
Lets further assume that instead of the previous List i want to display this as:<br />
<br />
Name : A<br />
// Here resultVar was calculated with value=1<br />
Value $: DoSomething1(resultVar) <br />
Value $2: DoSomething2(resultVar)<br />
Value $3: DoSomething3(resultVar)<br />
<br />
Name : B<br />
// Here resultVar was calculated with value=2<br />
Value $: DoSomething1(resultVar)<br />
Value $2: DoSomething2(resultVar)<br />
Value $3: DoSomething3(resultVar)<br />
<br />
<br />
I obviously don't want to calculate resultVar for each DoSomething{1,2,3} invocations... hence my question.<br />
<br />
I hope that now it's better explained what I'm aim to do.<br />
<br />
<br />
Thank you,<br />
Maxim.
mwilliams
Maxim,
Based off what I understand, you could probably just define one variable in the initialize method of your report design. Then, in the onCreate method of each "value" data element, you could set this variable to the value. You would then be able to use this variable in your other calculations. The value would then we replaced when the next list element is created.
Also, you could do something with PersistentGlobalVariables. This would allow you to name each variable by the value of the "name" field. Then you could call these PGV's at any time after they are created.
Let me know if you have any questions.