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

excel
activities

#1

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


#2

Hi @Komal_Joshi,

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

Regards,
Arivu :slight_smile:


#3

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


#4

Hi @Komal_Joshi,

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

Regards,
Arivu


#5

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


#6

Hi @Komal_Joshi,

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

Regards,
Arivu :slight_smile:


#7

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


#8

Hi @Komal_Joshi,

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

Regards,
Arivu :slight_smile:


#9

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.


#10

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


#11

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.


#12

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

Regards,
Arivu


#13

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


#14

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:


#15

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


#16

@Komal_Joshi i think you missed IIF


#17

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


#18

Sorry I missed it

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


#19

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


#20

@Komal_Joshi can you send the xaml file for better understanding

for me its working, in if condition give the condition

Regards,
Arivu