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)
Displaying text instead of a number
tdavies
I have a table and the data set field is a number. Is there a way to make my report display low, medium, or high instead of the number? Such as 30=Low, 60=medium and 100=high.
Thanks in advance!
Tammie
Find more posts tagged with
Comments
Tubal
You can either do this by creating an additional field in your query (if you're using an SQL db) with case statements:<br />
<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>SELECT myColumn1
,myColumn2
,....
,CASE WHEN myColumn1 <= 30 THEN 'Low'
WHEN myColumn1 BETWEEN 31 AND 60 THEN 'Medium'
WHEN myColumn1 >= 61 THEN 'High' END myLevel
FROM
....</pre>
<br />
Or you can create a new data element in your report and do it in javascript:<br />
<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>var myData;
myData = row["myColumn1"]
if(myData<=30){
'Low'
} else if(myData>30 && myData<61){
'Medium'
} else {
'High'
}</pre>
tdavies
Thank you very much! That worked perfectly.