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

Options
DEEPTMA2
DEEPTMA2 Dataiku DSS Core Designer, Dataiku DSS Core Concepts, Registered Posts: 2 ✭✭✭
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

Answers

  • Manuel
    Manuel Alpha Tester, Dataiker Alumni, Dataiku DSS Core Designer, Dataiku DSS ML Practitioner, Dataiku DSS Core Concepts, Dataiku DSS Adv Designer, Registered Posts: 193 ✭✭✭✭✭✭✭
    Options

    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
    tgb417 Dataiku DSS Core Designer, Dataiku DSS & SQL, Dataiku DSS ML Practitioner, Dataiku DSS Core Concepts, Neuron 2020, Neuron, Registered, Dataiku Frontrunner Awards 2021 Finalist, Neuron 2021, Neuron 2022, Frontrunner 2022 Finalist, Frontrunner 2022 Winner, Dataiku Frontrunner Awards 2021 Participant, Frontrunner 2022 Participant, Neuron 2023 Posts: 1,595 Neuron
    Options

    @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-p/9462

    @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.

Setup Info
    Tags
      Help me…