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)
Replace number 0 with string 'N/A'
mh10
Hi,
I have column with float data type....it has some 0 values...i am looking to replace these 0 values with string 'N/A'
any suggestions?
Find more posts tagged with
Comments
bhanley
You can use field mapping to do that. Field mapping allows you to display one value in place of another based on an expression value. <br />
<br />
Check out this post: <a class='bbc_url' href='
http://www.birt-exchange.com/devshare/designing-birt-reports/509-sample-birt-mapping-and-sorting-example/#description'>Sample
BIRT Mapping and Sorting Example - Designs & Code - BIRT Exchange</a><br />
<br />
It actually has a live example you can have a look at.<br />
<br />
Let me know if a sample report would help, I think I could dig one up.
mh10
I tried with Map feature....in it I added<br />
<br />
If 'col1' Equal to 0.0 <br />
then display N/A<br />
<br />
in my testing table one row has all 0.0 values.....and i need only on column value to set N/A. e.g.<br />
col1
col2
col3
col3
col4<br />
0.0
0.0
0.0
N/A
0.0<br />
<br />
but this condition is displaying N/A to all row <br />
<br />
N/A
N/A
N/A
N/A
N/A<br />
<br />
even it has changes group header also to N/A.<br />
<br />
<br />
Any suggestion? <br />
<br />
<br />
<br />
<blockquote class='ipsBlockquote' data-author="bhanley"><p>You can use field mapping to do that. Field mapping allows you to display one value in place of another based on an expression value. <br />
<br />
Check out this post: <a class='bbc_url' href='
http://www.birt-exchange.com/devshare/designing-birt-reports/509-sample-birt-mapping-and-sorting-example/#description'>Sample
BIRT Mapping and Sorting Example - Designs & Code - BIRT Exchange</a><br />
<br />
It actually has a live example you can have a look at.<br />
<br />
Let me know if a sample report would help, I think I could dig one up.</p></blockquote>
bhanley
Sorry, I must have misunderstood your need, thought you needed a row-level map. To do the mapping on a cell-by-cell basis, do the following:<br />
<br />
1) Double-click the cell to map (Val1 in the attached sample)<br />
<br />
2) The last text box on the dialog can be expanded to be a formula editor. Launch the formula editor and input the following formula:<br />
<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>dataSetRow["Val1"].match("0.0") ? "N/A" : dataSetRow["Val1"]</pre>
<br />
3) Save everything and preview your report. You should have mappings applied to only the modified field.<br />
<br />
The tenary expression handles the mapping at run-time. You should be all set.<br />
<br />
The attached sample will show things to you in working form if you need it. You will need to update the data source to point to where ever you save the CSV.<br />
<br />
Good Luck!
mh10
Thanks bhanley....it worked<br />
<br />
<br />
<blockquote class='ipsBlockquote' data-author="bhanley"><p>Sorry, I must have misunderstood your need, thought you needed a row-level map. To do the mapping on a cell-by-cell basis, do the following:<br />
<br />
1) Double-click the cell to map (Val1 in the attached sample)<br />
<br />
2) The last text box on the dialog can be expanded to be a formula editor. Launch the formula editor and input the following formula:<br />
<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>dataSetRow["Val1"].match("0.0") ? "N/A" : dataSetRow["Val1"]</pre>
<br />
3) Save everything and preview your report. You should have mappings applied to only the modified field.<br />
<br />
The tenary expression handles the mapping at run-time. You should be all set.<br />
<br />
The attached sample will show things to you in working form if you need it. You will need to update the data source to point to where ever you save the CSV.<br />
<br />
Good Luck!</p></blockquote>