Best way to update dynamic variable

Hi guys what would you do?

Currently I have the sequence like this
Repeat Number of Times 1000
Do
Get text “Variable1”
Get Text “Variable2”
If
Condition (Convert.ToDecimal(Variable2) - Convert.ToDecimal(Variable1)) = 0.10
Then Click to next page
I want it to keep repeating and checking the change in Variable2 until the condition is met
But no luck

Thanks for your help

@Daniel_Rabin1,

Can you please clarify if the condition is not working or the iteration not working?

If condition is not working properly then, check the value from the website is 2 decimal point. If required, use Math.Round function to round it to 2 decimal and then compare with 0.10

Hi @Daniel_Rabin1

I think there are multiple ways this can be done using any type of iteration. But i think While loop will be the best option.

Take a infinite while loop or take a specifc no that you know will be your records

While True
   
    Variable1 = Get Text activity for Variable1
    Variable2 = Get Text activity for Variable2

    ' Check Condition 
    If (Convert.ToDecimal(Variable2) - Convert.ToDecimal(Variable1)) = 0.10 Then
        ' Click to next page
        Click activity

        ' Break the loop as match is found
        Break
    End If
End While

Hope this helps :slight_smile:

1 Like

I tried While but maybe I have the condition wrong
CDbl(vari2) - CDbl(vari1) = 0.10

but it ends the loop before the condition is met
Ive previewed the extraction values Vari1 was 11.03 and Vari2 is always changing last i checked it was 11.05 not 11.13 which should end the loop and click the next page

Hi @Daniel_Rabin1

Can you share screenshot of your code. & sample data of those 2 variables.