0

I need to add an if statement to an email:

if(equals(body('Aktualizuj_element_2')?['Typ_x0020_urlopu']?['Value'],'Badania lekarskie'),'Inne', body('Aktualizuj_element_2')?['Typ_x0020_urlopu']?['Value'])

This if work correctly.

Now I need convert this if and add OR, so I added:

if((equals(body('Aktualizuj_element_2')?['Typ_x0020_urlopu']?['Value'],'Badania lekarskie') or (equals(body('Aktualizuj_element_2')?['Typ_x0020_urlopu']?['Value'],'Inna nieobecność (kod 350)')),'Inne', body('Aktualizuj_element_2')?['Typ_x0020_urlopu']?['Value'])

But flow return me alert:

the expression is incorrect

How can I use OR in an IF statement?

0

OK, I found resolve, this is correctly used or:

if(or(equals(body('Aktualizuj_element_2')?['Typ_x0020_urlopu']?['Value'],'Badania lekarskie'), equals(body('Aktualizuj_element_2')?['Typ_x0020_urlopu']?['Value'],'Inna nieobecność (kod 350)')) ,'Inne', body('Aktualizuj_element_2')?['Typ_x0020_urlopu']?['Value'])
  • Hmm...In my formula there is an extra bracket/paranthesis before first equals. – Ganesh Sanap Feb 25 '19 at 12:38
0

Hi IF Statement have (Condition,True,False), so you need to use it this way:

  • if(or(equals(items('Apply_to_each'),'TEXT1'),equals(items('Apply_to_each'),'TEXT2')),'TRUE','FALSE')
  • if(or(equals(body('Aktualizuj_element_2')?['Typ_x0020_urlopu']?['Value'],'Badania lekarskie'),equals(body('Aktualizuj_element_2')?['Typ_x0020_urlopu']?['Value'],'TEXT2')),'Inne',body('Aktualizuj_element_2')?['Typ_x0020_urlopu']?['Value'])

Hope it helps!

  • No, still I have this same error: the expression is incorrect – michal Feb 25 '19 at 10:14
  • edited, the first working for me, the second is how it looks like for you – Zdeněk Vinduška Feb 25 '19 at 11:15
0

looks like you have missing paranthesis. try using this:

if(or((equals(body('Aktualizuj_element_2')?['Typ_x0020_urlopu']?['Value'],'Badania lekarskie')),(equals(body('Aktualizuj_element_2')?['Typ_x0020_urlopu']?['Value'],'Inna nieobecność (kod 350)'))),'Inne', body('Aktualizuj_element_2')?['Typ_x0020_urlopu']?['Value'])

References:

  1. Use expressions in conditions to check multiple values.
  • No, still I have this same error: the expression is incorrect – michal Feb 25 '19 at 10:13
  • Try using @or function. see updated formula in answer – Ganesh Sanap Feb 25 '19 at 10:18
  • Still this same error, I will try to use this answer link – michal Feb 25 '19 at 10:22
  • try removing @ before or. – Ganesh Sanap Feb 25 '19 at 10:27
  • I removed, but still I have error – michal Feb 25 '19 at 10:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.