Activities if

Hello everyone, I am working on a project that consists of the following: the robot must open a ordered site to generate random numbers. after a certain number falls, you must continue opening another site. I tried a activities if (variable.equals(5) ) but it does not go that way. any ideas how to happen?

Hi

Welcome to UiPath forum

If you want to move to another page after five attempts then use a while activity

Where include all the activities inside that while loop and atlast inside the loop use a assign activity like this

counter = counter + 1

Where counter is a variable of type int32 with default value as 0 defined in variable panel

And while loop set the condition as

counter < 5

If the count goes beyond five it will come out of loop and then you can try with next page

Cheers @pl.rusinov

Hi @pl.rusinov ,

Assuming that you want the website to open atleast once, you could use a Do While like so:

image

If you want the website to open only if the randomly generated number allows it i.e., if its zero then the website should not open even once, then use the While Activity like so:

image

The int_randomNumber is generated by the site you speak of, while the Index is a local variable generated by the Do While/While Activity.

We are adding 1 to it since the index starts from 0.

image

I hope that helps.

Kind Regards,
Ashwin A.K

not. that’s not the point. I will try to explain: the robot opens a site to generate random numbers. the number is generated after pressing a button. the request is if a specific number is generated to continue opening another site if another number is generated to press a button until the specified number is generated. with IF and with flow decision does not work. maybe I confuse the condition.in condition I say variable=5, but when the number drops continues to press the button.
if in the condition I say variable<>5 opens the site of any generated number.

that’s not the point. I’il try to explain. the robot opens a site to generate random numbers. numbers are generated after pressing a button. the request is after generating a specific number to open another site, and if this number has not been generated, continue to press the button.

Fine
On a simple note we can use RETRY SCOPE activity where in the action block have the click activity that clicks the button
And in condition block use a ElementExists activity and indicate on a unique element that comes along with the generated number
Any element, may be a button or field or text

If the element Couldn’t be identified then we can make use of WHILE Loop where inside the loop use a CLICK activity and click that button
Inside the same loop then use a GET TEXT activity and get the output as stroutput
Where indicate on that generated number as a element

Now in while loop condition mention as
String.IsNullOrEmpty(stroutput.ToString)

If true it will run until a random number is generated

Cheers @pl.rusinov