How to compare the decimal value with the excel column data in uipath?

Hi,
I have an excel sheet with multiple columns. I have to perform a check to compare the numeric value from column “CTC” with 0.5. If the value found to be <0.5, I have to delete the row.
I tried to perform " int32.Parse(row(“CTC”).ToString) < 0.5 " in if condition, but gives error as : Input string was not in a correct format. Please provide me the solution on this.

Regards,
Komal

Hi @Komal_Joshi,

Try this
Convert.ToDecimal(row("CTC").ToString())<0.5

Regards,
Arivu :slight_smile:

Thank you for your response. I tried with this but still it is giving me the same error.

Hi @Komal_Joshi,

Try to put log message and check what value are you getting.

Regards,
Arivu

ok Thanks. It doesn’t display the decimal values but does give out the same error.

Hi @Komal_Joshi,

Try this code
Convert.ToDecimal(Convert.Tostring(row("CTC")))<0.5

Regards,
Arivu :slight_smile:

Hi. Thanks. Still the same error and Exception type: Format Exception

Hi @Komal_Joshi,

Try this
Decimal.TryParse(Convert.Tostring(row("CTC")),0)<0.5

Regards,
Arivu :slight_smile:

Thanks.
It is not allowing the condition, gives the compiler error as :
image

Even if I put it in If box as an independent condition and not storing in a Boolean variable, it still says the same.

You asked if condition but you are assuming value??? Can you elaborate it,

Well, I have multiple conditions to pass so I have stored those as values in boolean variables and have OR ed them in ‘If’ box. I need a condition to give.

Use it in if condition then store the result in Boolean variable.

Regards,
Arivu

Yeah. Thanks. I did that too. but is giving me the same error. Please check.
image

Sorry now i got it what is the issue.@komal_Joshi

use below code
Convert.ToDecimal(iif(String.IsNullOrEmpty(row("CTC")),"0",row("CTC").ToString()))<0.5

Regards,
Arivu :slight_smile:

Hi @arivu96, Thank you for your inputs. But it is giving the error:

@Komal_Joshi i think you missed IIF

ok. Yeah. Sorry. Tried again but gives error:

Sorry I missed it

Convert.ToDecimal(iif(String.IsNullOrEmpty(Convert.ToString(row("CTC"))),"0",Convert.ToString(row("CTC"))))<0.5

OK. Thanks.
It’s giving the earlier error after execution as - Assign : Input string was not in a correct format.

@Komal_Joshi can you send the xaml file for better understanding

for me its working, in if condition give the condition

Regards,
Arivu