Write condition for the multiple variables

Hi, Here I’ve written a condition for the status1, same wise in this same condition i want to include the other statuses as well.

How to write a condition for this ?

1 Like

Hi,

Hope the following sample helps you.

This returns true if all status is either of Yes , Okay or Completed.

Regards,

3 Likes

Hi @Praveen_Vs

The Switch activity might help you with this.
You can “switch” the value of an expression and each “case” represents the possible value of the status.
image

You can write individual sequences for each case.
image

image

Please make sure to change the TypeArgument to String to accommodate String cases. By default, this is set to Int32.
image

Here is the workflow to get you started: SwitchStatus.xaml (4.8 KB)

Happy Automation!

1 Like

Make it an array

Assign myArray = {“Yes”,“Okay”,“Completed”}

Condition: myArray.Contains(someStatus)

2 Likes

This works, @Yoichi
Incase if any of the status is “No or Fail” means it will go to the else part, In that else part i need to get the Status & its value as “No or Fail”

Write line be like
Unable to proceed due to Status6 has the value ‘No’

How to do this ?

Hello.

Try using the flow switch.

Hug

1 Like

If you have three statuses - Yes, Okay, and No - and use an If with condition {“Yes”,“Okay”}.Contains(someVar) then the Then block will be executed if someVar is not Yes nor Okay. This is standard If/Then stuff.

Hi,

The following will work as you expect.

Sample20220623-1.zip (2.6 KB)

Regards,

2 Likes

@Praveen_Vs
After posting my answer I realised that @Yoichi had the more suitable answer to your problem statement.

The Switch statement may be useful in a different scenario but with many-to-many (many variables each with many possible values) is better addressed with the Contains check as showed by Yoichi.

Please consider marking that post as Solution so that the topic may close automatically.
Cheers!

2 Likes

@Yoichi This works great, One more thing
Incase the vars be like {FormalStandStatus, UnknownLinkStatus, RegisteredStatus} instead of {Status1,Status2,Status3} ,
what will be the Expression ?
The message needs to be “Not proceed due to FormalStandStatus has No”
Attached the file for the reference
Sample20220623-2.zip (2.6 KB)

1 Like