Home
Analytics
expression issue
hatra
<p>hi Experts,</p>
<p>I have this script on my older version of a reporting tool :</p>
<p> </p>
<p> </p>
<p>whileprintingtrcords;</p>
<p>stringvar sd;</p>
<p>if { function} like "qw" then bb := "quality work"</p>
<p>else</p>
<p>if {funcrion} like "bd" the bb := "bad door"</p>
<p>else</p>
<p>if {function} like "ny" the bb := "not yellow"</p>
<p>else</p>
<p>{function}</p>
<p> </p>
<p>and I want to use the same logic on BIRT Expression, I used the exact syntax but it gives me error and I also try to modify but it seems like I am doing something wrong the {function} filed in my design called</p>
<p>row["function"]</p>
<p>I appreciate any help advise</p>
<p>thanks</p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
Find more posts tagged with
Comments
Clement Wong
<p>In your script from the other reporting tool, it appears that you just trying to change the value from one to another.</p>
<p> </p>
<p>In BIRT's scripting, you will be using JavaScript. To change the final value in BIRT, you have many options to do this:</p>
<p> </p>
<p>1. Created a Computed Column of String data type at the Data Set level. You can use if..then...else, or a switch statement.</p>
<p> </p>
<p>For example:</p>
<pre class="_prettyXprint _lang-">
if (row["function"] == 'qw')
'quality work';
else if (row["function"] == 'bd')
'bad door';
else if (row["function"] == 'ny')
'not yellow';
else 'unknown';
</pre>
<p>2. Create a "Map" at the Data item level.</p>
<p> A. Select the data report item in the Layout</p>
<p> B. Select "Property Editor - Data" in the lower right pane</p>
<p> C. Click on the "Map" tab</p>
<p> </p>
<p>From there you can click on "Add..." to define say "Value of this item" "Equal to" "dw". Then display following value: quality work.</p>
<p> </p>
<p> </p>
<p>There are other options, but these two are the easiest to understand and implement.</p>
hatra
<p>thanks Clement option one is what I needed, I am just not good at JavaScript
</p>