Flow switch activity with strings and wildcards

I’m trying to use the flow switch activity to read the value of an aaname attribute (string) of a window and then, do some actions according with the value.
I have change the typeArgument of the flow switch activity to String and in the “Case” attribute I type the different possible strings for example:

  • “Execution OK”
  • " Execution OK "

But I have some doubts:

  • Should I write the strings between " " or ’ '? The flow always goes to the default case even if the string seems to match. I have read that I don’t have to use " or ’
  • Can I use wildcards at the beginning or end of the string? Some of the strings start with spaces and when I create the case, the activity clear the spaces so it can be a reason why the flow selects de default case.

When I type in the case Execution OK with or without " or ', it doesn’t work and the flow finishes going to the default case when the string is " Execution OK ".

Thanks in advance

Hello @rodrigo.garcia
Have you unchecked Isdefaultcase in the properties pane ?

defa

and you have to write it with out any quotation marks

Yes, I’ve unchecked IsDefaultCasedefault in all branches except the default one (in total, I have 5 different branches).
If I don’t uncheck that property, I can’t write the string value.

About write the string without quotation marks, how can I write wildcards in the strings?

hello @rodrigo.garcia
can you please explain me this

One more thing why are you using two different cases for these two values

are you getting these values different for different operations ?? because what you can do is use Trim method and make the two cases in to one.

Wildcards as in ? do you want to put wildcards for cases ?

Hello @vickydas

I try to answer:

I wanted to say that I have to uncheck the property IsDefaultCase to write the string in the property “Case”. Sorry for my english -_-’

That was an example. Some values are “Execution OK”, in other cases the value is " ERROR: Timeout " (probably the developer did something strange with that value and wrote those spaces). The case matches when there isn’t any space at the begining or the end of the string, but when it has, never finds the match. I will try you suggestion of use Trim. How I should do that? Trimming the variable I read with get attribute? I’ve never used it.
I also thought about create a variable with the assign activity and assign the string with the white spaces at the beggining or the end and then, write the variable in the property “Case” as a workaround. Do you think that can work or the case attribute will think the name of the variable is a string itself?

I wanted to use wildcards to escape the spaces at the begining or the end of the string but it didn’t worked.

Hello @rodrigo.garcia

when the value does not have space it’ll match the switch case and execute the sequence, but when it contains even a single space whether at the start or end it wont match as the activity is looking for the value without space and
you cannot add two same value with spaces and without spaces as the Flow Switch Activity would not allow you because for the activity these both are the same value.

What you could do is once you get the value from Get Attribute and store it in a variable inside the flow switch Activity and Expression of the activity where you give your variable just add .trim after the end of the variable like this

Trim

It’ll cut all the Extra space from both sides and then it’ll match the respective case
Try it out and let me know if this works

Worked perfectly as you suggested, thanks!

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