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 "
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 ".
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.
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
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