I am not able to write it in Formula Language for "if and elseif" in DSS, please help me to get it

DEEPTMA2
Level 1
I am not able to write it in Formula Language for "if and elseif" in DSS, please help me to get it
if [CAPS] > 1 THEN 'CAPS'
elseIF ([PFS]) > 1 then 'PFS'
ELSEIF ([SJIA] > 1 and [RA] <= [SJIA] AND [JA] <= [SJIA]) THEN 'SJIA'
elseif [FMF] > 1 then 'FMF'
ELSEIF [AOSD] > 1 THEN 'AOSD'
ELSEIF [JA] > 1 then 'JA'
elseif [RA] > 1 then 'RA'
ELSE 'OTHER'
endif
0 Kudos
2 Replies
Manuel
Dataiker Alumni

Hi,

The syntax is if(condition, value if true, value if false). You can nest as many ifs as you want as in your example.

I hope this helps.

tgb417

@DEEPTMA2 ,

Welcome to the Dataiku Community.

I notice that in your example you are typing if else in mixed cases.  Dataiku's formula language is cases sensitive. When I started using it that case sensitivity caught me off guard.  Here is a prior thread on this topic.

https://community.dataiku.com/t5/Using-Dataiku-DSS/How-do-I-use-If-Then-Else-for-String-comparison/m...

@Manuel comments are great. DSS's does not provide an elseif syntax.  The syntax is much more like MS Excel here is a thread on that topic there is a bit more of a discussion.

https://community.dataiku.com/t5/Using-Dataiku-DSS/Nested-IF-with-OR/m-p/12442/highlight/true

Please let us know how you are getting on with the formula language.  Once you master it there are a bunch of powerful things that you can do.

--Tom
0 Kudos