Jump to content

If Or Statement


Chris Fries

Recommended Posts

Hi there,

While Spotfire uses some of the same function names as Excel, the syntax is normally different. So there are a couple of ways to achieve if ors (as well as ands). You can use the standardIF statement. For example, using your code above:

 

if([Column2]="SDS" or [Column2]="Emergency Room",Concatenate([Column1],[Column4]), "")

 

(Note that column names must be wrapped in square brackets)

So you can add as many 'or' or 'and' statements inside one IF statement. You can even embed IF statements if you needed. The other optionis CASE statements which let you define many conditional tests. For example:

 

case

 

when[Column2]="SDS" thenConcatenate([Column1],[Column4])

 

when[Column2]="Emergency Room" thenConcatenate([Column1],[Column4])

 

else

 

""

 

endCase statements are nice for when you have many conditions / tests, or complex tests as a large IF statement can become hard to read / update. They also evaluate sequentially allowing for control of which condition is met when.

 

For all functions, when you are in the expression editor, if you use the serach for the function name from the menu on the right, click on it. Then a summary of that function appears. All function summaries have examples at the bottom of the help which I find very useful.

 

There is great new book out that is good for people new to Spotfire, or moving from Excel in case it is of use:

https://community.spotfire.com/wiki/tibco-spotfire-comprehensive-primer-second-edition-andrew-berridge

 

Thanks

Colin

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...