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)
How to check the data element visibility
noe-su
<p>Hi,</p>
<p>On my data element (dataSetRow["invest_amt"]) I have a visibility expression and on render I have a javascript statement.</p>
<p>My problem now is that it executes the javascript also if it is not visible, so I like to extend the javascript statement with something like "if (this.isVisible()){}".</p>
<p> </p>
<p>
</p>
<p>Visibility expression:</p>
<p>row["allocn_typ_cd"] != "INVEST" && row["allocn_typ_cd"] != "INVEST_YRC"</p>
<p> </p>
<p>
</p>
<p>Javascript:</p>
<p>if (reportContext.getPersistentGlobalVariable("invest_amt")){<br>
var subtotal = 0 + parseFloat(reportContext.getPersistentGlobalVariable("invest_amt")) + parseFloat(this.getValue());<br>
}<br>
else{<br>
var subtotal = 0 + parseFloat(this.getValue());<br>
}<br>
reportContext.setPersistentGlobalVariable("invest_amt",subtotal.toString());</p>
<p> </p>
Find more posts tagged with
Comments
pricher
<p>Hi,</p>
<p> </p>
<p>The onRender method should not excecute if the element is not visible. Can you send your report design?</p>
<p> </p>
<p>P.</p>
noe-su
<p>The report design has to many other things in to send but I try to explain more detailed.</p>
<p> </p>
<p>I have a table connected with the dataset NQ_positions.</p>
<p>I have tree columns: "Name", "Investment", "OTC"</p>
<p>The name is taken as dataSetRow["name"]</p>
<p>The investment and the OTC is taken from the same value: dataSetRow["invest_amt"]</p>
<p> </p>
<p>On the Investment I have the visibility expression: row["allocn_typ_cd"] != "INVEST" && row["allocn_typ_cd"] != "INVEST_YRC"</p>
<p>On the OTC I have the visibility expression: row["allocn_typ_cd"] != "OTC" && row["allocn_typ_cd"] != "OTC_YRC"</p>
<p> </p>
<p>On the Investment I have the onRender</p>
<p style="margin-left:40px;">if (reportContext.getPersistentGlobalVariable("invest_amt")){<br>
var subtotal = 0 + parseFloat(reportContext.getPersistentGlobalVariable("invest_amt")) + parseFloat(this.getValue());<br>
}<br>
else{<br>
var subtotal = 0 + parseFloat(this.getValue());<br>
}<br>
reportContext.setPersistentGlobalVariable("invest_amt",subtotal.toString());</p>
<p>On OTC I have the onRender</p>
<p style="margin-left:40px;">if (reportContext.getPersistentGlobalVariable("otc_amt")){<br>
var subtotal = 0 + parseFloat(reportContext.getPersistentGlobalVariable("invest_amt")) + parseFloat(this.getValue());<br>
}<br>
else{<br>
var subtotal = 0 + parseFloat(this.getValue());<br>
}<br>
reportContext.setPersistentGlobalVariable("otc_amt",subtotal.toString());</p>
<p> </p>
<p>Later I have somewhere the dynamic text</p>
<p style="margin-left:40px;">parseFloat(Math.round(reportContext.getPersistentGlobalVariable("invest_amt") * 100) / 100).toFixed(2);</p>
<p>and</p>
<p style="margin-left:40px;">parseFloat(Math.round(reportContext.getPersistentGlobalVariable("otc_amt") * 100) / 100).toFixed(2);</p>
<p> </p>
<p>And the Problem is that all OTC Amounts are hidden, so they should be 0 but getPersistentGlobalVariable("otc_amt") gives the same value back as getPersistentGlobalVariable("invest_amt").</p>
<p> </p>
<p>....</p>
<p>but when I read my explanation... I think I know the reason... Maybee I should not use the same variable name "subtotal" in both render scripts</p>
noe-su
<p>I did now add an always invisible dynamic text above my problem.</p>
<p>As Text I did use:</p>
<p style="margin-left:40px;">if (row["allocn_typ_cd"] != "INVEST" && row["allocn_typ_cd"] != "INVEST_YRC"){<br>
"is NOT visible";<br>
reportContext.setPersistentGlobalVariable("isVisible","false");<br>
}<br>
else{<br>
"is visible"<br>
reportContext.setPersistentGlobalVariable("isVisible","true");<br>
}</p>
<p>And I did wrap my Problem in:</p>
<p style="margin-left:40px;">if (reportContext.getPersistentGlobalVariable("isVisible")=="true"){<br>
//execute my Code</p>
<p style="margin-left:40px;">}</p>
<p> </p>
<p> </p>
<p>Ugly solution, but it did solve my problem.</p>