If activity in the datatable

Hi friends,
I have a Datatable and using if activity to read row but when it comes to end of row it pop up an error msg. Please assist. Thank you.

error

Hi @jojo123,
Indexing is always starting from 0 in data table. It means if you have 10 records those will be indexed from 0 to 9. So I guess in your workflow you need to add “-1” to your “sqrDescCurrIndex”.

2 Likes

Hi @Pablito,
My wanted value starts from 1 as shown

image

so I set sqrDesCurrIndex =0 at the beginning and then add +1 before the if activity.

Is there any issue?
image

Thank you.

What value are present in that variables?
sqrDesCurrIndex

Hi,
I set sqrDesCurrIndex =0 at the beginning and then add +1 before the if activity. The first value is test.sqc but after last value es4.sqr, it gives me that error msg " index was outside the bounds of the array"

are u spliting some values ?

yes :slight_smile: I did . i need to copy files (e.sg test sqc, try.sqr and etc) to other folder . But the number of files is not consistent. I’m able to copy those files over but come to the last file (end of if activity). I got that error msg.

Thank you.

Whats your requirement exactly so that i can tell u the way?
Or send me ur workflow

I am not getting
Tell me one thing which array is you are using
And what does it carry means which data are present in that array after split
Then U want it to use that array details to be use as file name to be moved?

After Data scraping,

I’m using assign activity
a) to get the row with header ‘desc’
output:

b) Spilt the value and descSplit(1)
output:
Name: test.sqc
c) Trim away the Name :
output:
test.sqc

After getting the test.sqc , I search this file in the windows explorer and copy it. from there go to another folder and paste. Repeat to end of that cells .

similarly u want to do it for try.sqr , yes2.sqr and est4.sqr ryt?

yes :slight_smile: my if activity can copy all the files and paste to the destination. But can the end of files , it suppose to out the loop and yet it gives me that error msg.

When u split that data then it will store it in array
so u can iterate through For Each
so it will automatically exit

what are u checking in that if condition?

The above mentioned errors are always associated with the “Index”. If your want to iterate through the data in row the index starts from"0" OR If your are working with the specified headers in the column the index starts form “1”. so plan accordingly.

here is the data scraping result , shop ABC is the item that I need to copy files and paste to other folder . The number of files is not consistent.

desc
Shop: ABC
Name: test.sqc
try.sqr
yes2.sqr
est4.sqc
Shop : DEF
Name: testing
Shop: ABC
Name: test.sqc
Try1.sqr
yes22.sqr
est14.sqc
test4.scr
one.scr

There are two times Shop ABC present
You want first one or last one

yes :slight_smile: but the number of files is not consistent so I use if activity.

If you are getting those file names after splitting then u dont need to check it by index u can iterate them using for each

My bot is running daily and it will do data scraping in the service request . And I read data from the data table . if there is a shop ABC , I need to check thru all any files need to copy to destination. So there may be 2 or 3 shop ABC.