Advanced Loop fields

Hi,

I have used advanced loop to read two excel files which contain numerical values. I have specified the argument type as numeric inside the advanced loop.

Now I want to check a condition and then add this value to a datatable I created. But to add row in the datatable, I have to assign first to a variable right? How do I assign a numeric value from the datatable to a variable? It shows unable to assign from system.object to int.

For example, if I want to assign a string I use “variable=outres.item(0).tostring()”
Similarly I want to assign a numeric value in the datatable to a variable. How do I do this?

I want to add two columns from the advanced loop sheet and ‘add row’ to a created datatable.

Thanks for the help
Regards

Hi,

You can use function Convert.ToInt32

Regards,
Amit Anand

Hi Amit,

I have used this in the assign block as
empno=convert.toint32(outres1.item(0))
But when I test run, it shows ‘one of the child activities failed’ as error.

Can you please help?

Also, when I use
outres1.item(1).equals(outres2.item(1))
this expression to compare two numerical values, it doesn’t give the output as expected… Why is this happening?

Thanks and regards

Hi,

First check what value is coming in outres1.item(0). Use a ToString function to assign to convert it to string if required. Do a write line to check

Post that create an Int32 argument and using Assign activity assign the integer value to that argument

Again do a write line to check if correct value comes

Hi @amit_anand15

I have an excel sheet with the first column containing numbers store as text (For eg. 1010, 2010, 3020 etc) and another column in the same excel sheet also having numbers stored as text (For eg. 1010, 21.0, 12.5 etc)

I used “convert.toint32(outres.item(x))” and assigned it to a variable for both these columns. For the first column it works fine and the output is coming using the Writeline activity but when I use the same expression and try to use writeline for the second column, error shows up as “One of the child activities failed” under advanced loop. Why is this happening?

This error occurs in the second column when it comes across a number stored as text only. If it contains numbers, this doesn’t come up.

Thanks for your help Amit

Regards
Stevin