Create if, then, else statements

Sv3n-Sk4
Level 3
Create if, then, else statements

Hello everyone,


Sorry to bother you but I am looking everywhere and can't find the Create if, then, else statements.

I would like to create a formule with the help of the creator that we can see here but I am not able to find where to get it.

Create if, then, else statements โ€” Dataiku DSS 11.0 documentation

 

Thanks a lot for the help.

0 Kudos
7 Replies
JordanB
Dataiker

Hi @Sv3n-Sk4,

Processors can be found in Prepare recipes. In a prepare recipe, select "+add a new step" and search for the processor (as shown below). Please let us know if you have any questions.

Screen Shot 2022-10-18 at 1.43.47 PM.png

Thanks!

Jordan

Sv3n-Sk4
Level 3
Author

Hey @JordanB ,

Thanks a lot for you quick answer!

I was looking where I should but unfortunately it seems my version (from where I work) hasn't got this processor....

Thanks anyway ๐Ÿ™‚

0 Kudos
JordanB
Dataiker

@Sv3n-Sk4 

No problem! And, so you're aware, this processor was released in DSS version 11.

Best,
Jordan

0 Kudos
Sv3n-Sk4
Level 3
Author

That's where the problem was.

I just learned we only still are at the 9.0 version.

I will try to find a way to create my if else statement!

Thanks a lot!

0 Kudos
JordanB
Dataiker

Hi @Sv3n-Sk4,

You can create an if/else statement with a formula processor in a prepare recipe. The statement could go something like this:

if(customer_id == col1, col2, col3) which resolves to if condition (customer_id) equals col1 then execute col2, else execute col3

Please let me know if you have any questions.

Thanks!
Jordan

0 Kudos
yesitsmeoffical
Level 3

is it possible to reorder the "then" logic with multiple entries?

for example:

IF A == 1,

THEN

C == 3

D == 4

B == 2

is there an easy way to place B in front of C and D without rewriting the entire thing? 

0 Kudos
tgb417

@yesitsmeoffical ,

Just a hint in case it helps you.  This is an advanced technique.

When I find the user interface does not allow me to reorder parts of steps in visual recipes.  I will often copy the recipient step out of DSS in the usual way.  Which put the step on my computers clipboard.  Then rather than immediately pasting the step back into the visual recipient.  Iโ€™ll paste it into an IDE like visual studio that supports JSON formatting. Iโ€™ll then manually edit the recipient step in visual studio,  copy the step out of visual studio and paste it back into Dataiku DSS in the usual way.  This has many times saved me from a lot of extra effort when it comes to working with visual recipes.

Note: there is no documentation for these JSON snipits. And the support team is not likely to provide support if you run into problems.   That said for many of the visual steps the JSON is fairly intuitive.  

good luck.  Also if you are running into a problem with the UI you can also add a product idea to the forums.  

--Tom
0 Kudos