Which Activity is the Best to Use?

Hi again!!

I was wondering which activity I should use to set a variable to different values depending on what string is contained in another variable. For example, this is what I want to do:

Variable1 = String
If Variable1 contains “Do This” set Variable2 to “Type 1”
If Variable1 contains “Do That” set Variable2 to “Type 2”
If Variable1 contains “Blah Blah” set Variable2 to “Type 3”

I am trying to use the Pick activity and pick branches to assign the variables, but I am not sure what to use in the Trigger area or if this is even the best way to do what I need.


You can use invoke code activity and put all IF conditions together.

It is explained in one of the foundation videos (don’t remember chapter).

Karthik Byggari

1 Like

Hi @KarthikByggari, that is something I should probably look into as it would be easier in the long term, but I did find that the Is Match activity seems to work for checking if the variable contains a certain string.

You can directly use it in IF condition if variable contains sub string.

IF yourString.Contains("sub string") Then

1 Like

Sounds like you might use a Switch activity. Then, use inline If statements. You can also skip the Switch and just place it in an Assign activity:
Assign: variable2 = If(variable1.Contains("Do This"), "Type 1", If(variable1.Contains("Do That"), "Type 2", If(variable1.Contains("Blah Blah"), "Type 3", Nothing ) ) )

And, you can use Is True or Is False activities, found in the Workflow Manager package, to create a Boolean, if you want. However, it requires an additional variable.



I’ll also add, you can use the Is True or Is False in the PickBranch if that’s the approach you want to use.

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.