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)
Resetting a variable on change of group
bakinzer
<p>The report I am trying to do groups lists appointments with their statuses so they are grouped by the appointment ID and different rows contain the different statuses such as "Checked In" "In Room" etc.</p><p>I am trying to save detail data into a varible to use at a group level. I initialize the variable in onInitialize method for the report.</p><p>At the detail level I am doing this to populate the value:</p><p><strong class='bbc'> if</strong> (<strong class='bbc'>this</strong>.getRowData().getColumnValue("Scheduling Action") == "CHECKIN")</p><p> checkinTime = <strong class='bbc'>this</strong>.getRowData().getColumnValue("Action Date and Time");</p><p> </p><p>The above works fine, the problem I am having is resetting the variable. I have tried doing it in the onPrepare, onCreate and onRender methods for the appointment Id group I am using.</p><p> </p><p>Any ideas would be appreciated. I am still pretty new at this.</p><p> </p><p>I am using BIRT version 3.7.2.</p>
Find more posts tagged with
Comments
BRM
<p>So what you are saying is that if the variable gets set to "****" in one of the detail rows it will retain that value when used in the footer even if a subsequent row would cause it to be set to some other value?</p><p> </p><p>Not sure but using variables across elements of reports like this seems like a job for PGV's. You might try</p><p> </p><p style="color:#000000;font-family:helvetica, arial, sans-serif;"><strong class='bbc'>if</strong> (<strong class='bbc'>this</strong>.getRowData().getColumnValue("Scheduling Action") == "CHECKIN"){</p><p style="color:#000000;font-family:helvetica, arial, sans-serif;"> temp_var = <strong class='bbc'>this</strong>.getRowData().getColumnValue("Action Date and Time");</p><p style="color:#000000;font-family:helvetica, arial, sans-serif;"> reportContext.setPersistentGlobalVariable("checkinTime", temp_var);</p><p style="color:#000000;font-family:helvetica, arial, sans-serif;">}</p><p style="color:#000000;font-family:helvetica, arial, sans-serif;"> </p><p style="color:#000000;font-family:helvetica, arial, sans-serif;">Then in the footer or wherever else you wanted to use the value you would do:</p><p style="color:#000000;font-family:helvetica, arial, sans-serif;">myVar = reportContext.getPersistentGlobalVariable("checkinTime")</p>
bakinzer
<p>BRM</p><p> </p><p>I found a different way to do what I needed using data elements at the detail level and aggregations at the group level.</p><p> </p><p>I still want to see why the original way I did didn't work so will try your suggestion of using a PGV.</p><p> </p><p>One thing though, your statement:</p><p>"So what you are saying is that if the <span>variable</span> gets set to "****" in one of the detail rows it will retain that value when used in the footer even if a subsequent row would cause it to be set to some other value?"</p><p>should not be a problem. Any time the varialble would get set it is set to something I need. The problem is that I can't unset it when I start a the detail for a new group. If the detail for that group doesn't have the condition the variable retains the value from the previous group.</p>