Home
Analytics
need to write javascript to display text based on a data field?
yaragallamurali
<p>in my birt report there is a data field and a label field. In the report i need to check whether data field is having value 0. if the value ==0 then i have to display "****" in the label otherwise i have to display "yyy" in the label.</p>
<p> </p>
<p>where should i write the javascript and what shoulld i write to achieve this.</p>
<div> </div>
<div> </div>
<div> </div>
Find more posts tagged with
Comments
mwilliams
<p>Is the label inside a table or grid bound to your data set and does the data set only return a single row? If so, you should be able to just check the row["yourfield"] value in the onCreate of the label and decide which value to show there.</p>
<p> </p>
<p>If the label is not in a table or grid bound to the data set, you could be sure to use separate run and render tasks and grab the value from the data element in the onCreate, store it in a PersistentGlobalVariable, and determine what to show in your label by grabbing this PGV in the onRender of the label and setting the text.</p>
<p> </p>
<p>If you're not using separate run and render and the label is not in a table or grid bound to the data set, you could likely just use a dynamic text element bound to the data set that the data element is bound to and write an expression checking the data value to determine the label value.</p>
<p> </p>
<p>Hope one of these helps.</p>
yaragallamurali
<p>hi can anyone point to a good tutorial or documentation on javascript events in BIRT reports and how to write javascript in BIRT reports which contains some examples? I am a new bie and just want to understand how to write javascript. Thanks in advance.</p>
JFreeman
<p>This has some good information regarding scripting and the flow of events when a report executes: <a data-ipb='nomediaparse' href='
https://www.eclipse.org/birt/documentation/integrating/scripting.php'>https://www.eclipse.org/birt/documentation/integrating/scripting.php</a></p>
;
<p> </p>
<p>Is there anything in particular regarding scripting you are looking for some details on? So much can be scripted it will be best to point you to something specific for what you would like to accomplish. </p>
yaragallamurali
<p>Thanks Jesse. will work on it and will get back if i have more doubts.</p>