Bring your best ideas to the AI Use Case Contest! Enter to win 40 hours of expert engineering support and bring your vision to life using the powerful combination of Alteryx + AI. Learn more now, or go straight to the submission form.
Start Free Trial

General Discussions

Discuss any topics that are not product-specific here.
SOLVED

Formula Expressions

mayank_mishra24
7 - Meteor

Hi!

I am new to Alteryx and do not have much experience.

while doing weekly challenges I find problems understanding other's solutions especially the expressions used in formula tools (more specific multi row tool).

 

if [RecordID]=1 and !isnull([Value]) then
tostring(datetimeparse(regex_replace(replace([Value], " Total",""),".+- (.+)","$1"),'%b %d, %Y'))
elseif [RecordID]=1 and !isempty([Row-1:Value]) then [Row-1:Value]
elseif [RecordID]=1 then "DMA"
elseif [RecordID]=2 and isnull([value]) then "Total - Point of Sale"
elseif isnull(value) then 0
else value endif

 

like this one. it contains many conditions.

can anyone help me in how should I start learning expressions building.

 

3 REPLIES 3
caltang
17 - Castor
17 - Castor

As with anything in life, practice makes perfect. 

 

The statement you showed:

if [RecordID]=1 and !isnull([Value]) then
tostring(datetimeparse(regex_replace(replace([Value], " Total",""),".+- (.+)","$1"),'%b %d, %Y'))
elseif [RecordID]=1 and !isempty([Row-1:Value]) then [Row-1:Value]
elseif [RecordID]=1 then "DMA"
elseif [RecordID]=2 and isnull([value]) then "Total - Point of Sale"
elseif isnull(value) then 0
else value endif

 

The "IF" statement is giving a condition. IF something is TRUE then... For example, if you are thirsty, drink water, if you are not, then continue as you are.

 

Here is a site for you to learn more: https://www.w3schools.com/js/js_if_else.asp

 

IF statements are the bread and butter of logic within a build. So take your time! :)

Calvin Tang
Alteryx ACE
https://www.linkedin.com/in/calvintangkw/
caltang
17 - Castor
17 - Castor

@mayank_mishra24 If the above solved your need, kindly like & mark as accepted solution so that you may help others find the solution more quickly + to close the thread as is. Thanks!

Best regards,
Calvin Tang
https://www.linkedin.com/in/calvintangkw/

Calvin Tang
Alteryx ACE
https://www.linkedin.com/in/calvintangkw/
mayank_mishra24
7 - Meteor

Yes, it was very helpful.

 

Thank you, sir.

 

Labels
Top Solution Authors