Dynamic Selector Viriable Options

Hi All :wave:

Is it possible to use two or more variables inside a selector, for example:

<aaaname = ‘Variable1 Or Variable2’ />

I just want to know if this is possible, if yes what would be the correct syntax to archiving this?

Hi @SenzoD

Do you want to perform the AND OR operations as well in the selector based on conditions and use the variable accordingly?

In that case, I would suggest you to use an if condition in the workflow to handle the condition and assign the required value to the variable that you are going to use in the selector, and use that in the selector as

"<aaname='" + Variable.ToString + "' />"

So, say you have two variables as in your question which you want to add to the selector depending on some condition…

use it as

IF <your condition>
Then
   VariableUsedInSelector = Variable1
Else
   VariableUsedInSelector = Variable2

Now, in the selector

"<aaname='" + VariableUsedInSelector.ToString + "' />"

2 Likes

Hi @SenzoD ,

I don’t know if this is possible because my attempts were unsuccessful.
Therefore, I used the naming of variables depending on the type of case, then the variable received the appropriate name.

Another option I used with selectors was to check does the variable (string = a) with the selector exist as an element?
If the element exists then OK, if the element does not exist use the variable (string = b).

This was resolved by IF activity.

1 Like

Thank you, This solved my problem.

1 Like

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