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)
Expression to handle an if statement with three options
shortstack
I am having trouble trying to set-up an expression. What I am trying to do is have the report display a string for three different values.
if department > 162003 displaystring = "smith"
if department = 162002* display string = "johnson"
if department = 162003* display string = "williams"
I know how to do a regular if else statement when there is only two strings but how can I add a third in it.
Thanks in advance for your help.
Find more posts tagged with
Comments
foolcatjr
you mean the chart's title ? or a data element ?
shortstack
It would be a data element
johnw
/////////////////////////////////////////
var displaystring = "unknown";
//if this
if (department > 162003)
{
displaystring = "smith";
}
//of this
if (department = 162002)
{
displaystring = "johnson";
}
//or this
if (department = 162003)
{
displaystring = "williams";
}
displaystring;
///////////////////////////////////////
As an alternative, if department is a numeric type, you can consider using a switch/case statement.
shortstack
Thanks I will try that.
shortstack
johnw how would I do a switch/case statement. Thanks
johnw
Example of a case statement:
http://www.w3schools.com/js/js_switch.asp