How to subtract two rows using uipath

Hi Guys,

I need payroll calculation in excel format “=50000-50000/(30)*(2)”

*30–month and 2–loss of pay

i am using "(Integer.Parse(row.Item(6).ToString - Integer.Parse(row.Item(6).ToString)/cal(*Integer.Parse(row.Item(10).ToString))

*cal – variable for month value(30)

but result is ‘0’ because first 2 value subtraction output is 0

can anyone can help this

1 Like

Kindly try with this expression
Inside the FOR EACH ROW ACTIVITY
Use the first assign activity
Int_input1 = Convert.ToInt32(row(6).ToString)
Where Int_input1 is a variable of type int32 defined in the variable panel

And next a assign activity like this
Int_input2 = Convert.ToInt32(row(6).ToString)/cal*(Convert.ToInt32(row(10).ToString))

Now final assign activity like this
int_output = Int_input1- int_input2

Kindly try this and let know for any queries or clarification
Cheers @Raja.G

1 Like

@Raja.G,

Check with this line of code,

Convert.ToString( Integer.Parse(row.Item(6).ToString)-(Integer.Parse(row.Item(6).ToString)/(cal))*(Integer.Parse(row.Item(10).ToString)))
1 Like

@Palaniyappan,

Thanks, working fine

1 Like

Cheers @Raja.G

@Palaniyappan

I have a another question,

In excel row(A1) value is emp id–“abc123” to find row(E) – have multiple emp id , i need to find A1 value and than get same row(F)–salary

I attached excel screen shot for yours ref,

kindly help me

1 Like

we can use LOOKUP DATATABLE activity
–use EXCEL APPLICATION SCOPE and pass the file path as input and inside the scope use READ RANGE activity and get the output with a variable of type datatable named dt
–now use a FOR EACH ROW activity and pass the variable dt as input
–inside the loop use assign activity like this
str_input = row(1).ToString
–then followed by that use LOOKUP DATATABLE ACTIVITY where in the property
panel mention these
input - str_input.ToString
datatable - dt
Lookup column name - “Emp No1”
Out Result - str_output
Target Column Name - “CTC P.M”

where Out Result will be our output value we want

Cheers @Raja.G

1 Like

@Palaniyappan,

Thank you so much ,its working

1 Like

awesome
do we have any further queries to be discussed buddy

Cheers @Raja.G

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.