Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
PUBLIC CLOUD
PRIVATE CLOUD
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Intelligence (Analytics)
How to display a value in report depending on data fetched from DB
New_Bee
<p>BIRT Version 4.3.2</p>
<p>Java 1.8</p>
<p> </p>
<p> </p>
<p>from the database I receive numeric values of codes <br>
now according to the code value received I have to display a string in the report</p>
<p> </p>
<p>example :</p>
<p> </p>
<p>Code values = {1,2,3}</p>
<p>Corresponding string to be displayed = {"ABC", "XYZ", "MNO"}</p>
<p> </p>
<p>how do I do the mapping of the codes to their respective display strings and in the report, display the string ?<br><br>
<br>
I tried by having a data element with expression - <span style="font-size:12px;"><strong><em>valueOf(displaystring)</em></strong></span></p>
<p>
and in the onPrepare script of the data element I've put - </p>
<p> </p>
<p><span style="font-size:12px;"><strong><em>var displaystring ;<br>
var val = valueOf(dataSetRow["CODE"]);</em></strong></span></p>
<p><span style="font-size:12px;"><strong><em>if (val = 816240) { displaystring = "smith"; }<br>
else if (val = 162002) { displaystring = "johnson"; }<br>
else if (val = 162003) { displaystring = "williams"; }<br>
else if (val = 162003) { displaystring = "smith"; }<br>
else if (val = 162002) { displaystring = "johnson"; }<br>
else if (val = 162003) { displaystring = "williams"; }<br>
else if (val = 162003) { displaystring = "smith"; }<br>
else if (val = 162002) { displaystring = "johnson"; }<br>
else if (val = 162003) { displaystring = "williams"; }</em></strong></span></p>
<p> </p>
<p> </p>
<p> </p>
<p>This doesn't work. Could anyone help me out with this ?</p>
<p> </p>
<p>Thanks !!</p>
<p> </p>
Find more posts tagged with
Comments
micajblock
<p>There is a built in feature for this in BIRT call mapping. Have a data control for the code and add the mappings. See image</p>
New_Bee
<p>Thank you so much to pointing out this feature. Made my work very easy.<br><br>
Now I can add all the conditions to the map list. </p>