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)
problem with computed column
prashu_444
hi all,
I am retriving qty and status fields from database. if qty field value is 21 and status value is o then data should appear as 21% .if qty field value is 21 and status value is 1 then data should appear as 21 no .
I tried to achive this using computed columns . but its not working.
below is the computed column code ..
if(row["STATUS"]==0
{
return row["QUANTITY"] + "%" ;
}
else
{
return row["QUANTITY"] + " no" ;
}
any idea what is the problem. ??
or can we achive it in some other way ??
Find more posts tagged with
Comments
bhanley
The easiest way would be to manipulate the data mapping. I assume you are doing this in a table, so you could make the expression for the data element in the table something like this (where the "ind" column is your 0/1 indicator):<br />
<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>
if(dataSetRow["ind"] == 1)
dataSetRow["val"] + "%";
else
dataSetRow["val"] ;
</pre>
<br />
Once you add the "val" data to a table, double-click it and edit the expression.<br />
<br />
I have also done it using a dynamic text element. The code is logically the same, but syntactically different.<br />
<br />
Sample data and report are attached. Put the CSV in C:Data for the report to work as-is.<br />
<br />
Good Luck!