LOOP Creation on UiAutomation

I want to create a loop with the following conditions

My criteria are noted below

  • in a text box I want to pass a value from excel file
  • if that value is not unique in the system, the system will pop up a message box
  • Consider that message box as ELEMENT_EXIST
  • if that ELEMENT_EXIST is true then I will iterate the value taken from excel
  • In this method system will keep trying to generate a new unique string by iteration
  • when the system gets the new unique string it will show a new message box to continue.
  • at that point I want to break this loop and continue for the next item

Can anyone help me with the demo code?

Hi @Tanzill_Ahsan
i need one clarification

what u mean by iterating through the value, u mean one value after other if before one is not unique?

Hi @Tanzill_Ahsan
i am still in one doubt

you are typing somenumber like this for eg

123654.1, 123654.2 etc till message box accept came, which value u are taking from excel actually is it 123654?

Hi @NIVED_NAMBIAR

Yes, the excel value is 123456

By iterating I am making it like 123456.01, 123456.02 etc

Is it incremented by .1,.2 like that ?

You can have two loops, the inner loop will generate the “New Unique String” by iteration.
When the system gets the new Unique String , Based on element exist you can use the “Break” activity to come out of the inner while loop and the iteration continues with the outer loop

@NIVED_NAMBIAR

Yes it is. By .1, .2… like that

the whole activity is in foreach row

To read excel data one by one you can use “ForEachRow” activity …inside that you can use while loop for the iterations of each excel input(.01,.02,.03…), then you can use “Break” activity when it matches the unique string

hi @rrenu59

thank you for your solution but I am struggling with the loop. I can perform the iteration of .01, .02 etc but I am struggling when I am trying to get the next value.

Thnaks

I think you can use “Continue” activity(If Element Exist - Message Box), it skips the current iteration and starts with next iteration if you are using single loop

Hi @Tanzill_Ahsan
i had attaching the workflow representing the logic u can use in your workflow to work

try this and let me know if you need any further help

Main.xaml (15.0 KB)

Regards,
Nived N
Happy Automation

image
@NIVED_NAMBIAR you can share a long screenshot if there is any problem.

thanks

@NIVED_NAMBIAR

Maybe there is some version mismatches in your uipath and mine. Can you please share the screenshot of your workflow?

Hi @Tanzill_Ahsan
image

1 Like

@NIVED_NAMBIAR what is in the last Else part?

Hi @Tanzill_Ahsan
this is the else part sequence
image

Hi @NIVED_NAMBIAR

But there is no type into in your workflow. I need one to put the value of User Reference Number(UID)

image

Hi @Tanzill_Ahsan
i had added in comment section, in that i had explained what activities need to used etc

1 Like

Now I get it thanks
@NIVED_NAMBIAR

1 Like