Use multiple values in one condition with OR/AND

Hi UiPath Community
I have two dependent Dropdowns:
example:
dropdown1: new List(of String) from {“a”,“b”,“c”,“d”,“e”}
dropdown2: new List(of String) from {“a”,“aa”,“aaa”,“aaaa”,“b”,“bb”,“bbb”,“bbbb”}

I want that: if dropdown2 have the letter “a” (it could be “aa”, “aaa”…) in its value then the dropdown1 should have “a”
I know how to define the conditions one by one but I don’t know how I can set the If statement in once condition?
example: If dropdown2=“a” or “aa” or “aaa” or “aaaa” then dropdown a = “a”


I will attach the workflow.
Thanks in advance,
Best rgerads,
AybSequence_Category.xaml (8.7 KB)

1 Like

Follow these steps:

  1. For each value in dropdown2,
  2. use if, write the following condition:
  3. System.Text.RegularExpressions.Regex.Match(value,“^a+$”).Success
  4. then put dropdown1 value as “a”

Similar conditions can be used for “b”, “c” etc…, The above regex pattern checks for the string to match with one or more occurences of “a” and also makes sure that the string starts with “a” and ends with “a”

Hi Surya,
Thanks but where can I write it in a form?

Hi @ayyoub
We created the intended workflow for you. Let us know if you have any questions.
ConditionalDropdowns.xaml (11.0 KB)

1 Like

Hi @Nishant_Tanwar Thank you so much I will check it.
I have another question.
Do you know how to close a form without cancel button? I meand like in one logic I would like to check if an event happens (click on click button, text has value…) the action will be triggered which closes the form directly.£^
Unfortunately window.close() is not working in Javascript inside logics.

Thank you so much, and best regards
Ayyoub

Hi @ayyoub, Sorry but we cannot close the form without cancel button at the moment.

2 Likes

Hi @Nishant_Tanwar
I have one short question

I have a data grid with three rows

do you know how I can loop through thid data grid and check the value of one cell or column?

I tried to write something like that datagrid.rows(0)(0) in order to read the first cell on the first row but it disn’t work

thanks alot in advance

ana idea?

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