If condition greater than

hi experts,

I am trying to use If function. if the amount is less than x, perform activity A. if the amount is more than x, perform activity B.

somehow it doesn’t work.

If%20condition

2 Likes

If you show us the error you get specifically it will be easier to help. Make sure you have defined the variable “amount”, make sure it’s an integer not a string, and make sure you gave it an initial value somewhere in your sequence, before it reaches the if conditon

@Popo

What error are you getting ?

Is Amount variable is of type Integer or not ?

hi @AkisM

there’s no error encountered. it just that the bot keep choosing the wrong task to perform when I set the condition amount <5000, perform task A. else, perform task b

@lakshman amount is int32

@Popo

Before IF condition, take one Message box Activity and print like amount.Tostring and then check once.

1 Like

Hi buddy @Popo
you were almost done.
only thing we need to check now is the value of the amount variable
The reason is
–well its int32 - good
–if condition is entered correctly – good
–amount is not empty, else we will be thrown with error object reference is null – so good again

So finally only thing left is the value of the amount and we need to check whether it is < 5000
–For that we can use a write line activity or log message activity and check with the value of the amount…
–Use a write line activity before to this if condition and mention the value as
amount.ToString

This will display the value of the amount in output panel, kindly check with that and share the screenshot buddy
This can be easily resolved
Cheers @Popo

1 Like

@Palaniyappan
the bot still continue to perform the wrong task.

Hey @Popo,

I just had a look on the attached xaml.Is it the entire flow you have?

Because the amount variable is not intialized anywhere.

@amarasto
yes. that’s my entire flow. how do I make the amount as a variable? use assign activity?

Hey @Popo
In the variable pane this amount variable is already declared but does not have any default value.

try to assign it a value let say 50 in the variable pane and let me know the results.

@amarasto
the bot still chooses the wrong task btw else and then

@Palaniyappan @amarasto

the amount could range from 0 to 4999.99. does it means I can’t change the variable to INT?

@Popo

Then in IF condition try like this:

Cdbl(amount) < 5000

1 Like

@lakshman
it still chooses the wrong task. when the amount in my excel is more than 5000, it chooses the task that is less than 5000, which is wrong. the bot should choose task that is more than 5000

@Popo

Amount is coming from Excel sheet ?

Could you please take screenshots of the your process and show me once. Will check and update you.

@lakshman
yes, bot to check amount from excel sheets. sorry I didn’t make it clear earlier.

@Popo

Sorry I am not able to open this file and seems like some packages got corrupted. Could you please send me zip format along with project.json file.

@lakshman
let me know if you can open it. if not. I will send the screen shots.

@Popo

As you said, amount is coming from excel value. Try below one in IF condition.

If column name is amount then try this: Cdbl(row(“amount”).Tostring) < 5000

5 Likes