How to resove error of : Assign : Index was outside the bounds of the array

studio
error

#1

Dear all,

I have a question that when I tried to assign DataRow value into variables (GenericValue),
I got below error message…

Assign : Index was outside the bounds of the array.

How can I fix this? sorry for vague question but with my capacity it is the best I could describe in detail…


#2

@Kn.opp this error occurs due to more element in the specified array size


#3

Hi Kn.opp,

to give a bit more detail this error occurs when you are trying to access an index outside of the current bounds of the array.

e.g. you have an array of 5 items. (array {1,2,3,4,5}) if you try to get the item from index 10 (array(10)) you will get this error as there is actually only 5 indexes (the max being 4 as arrays start at 0).

Could you give more info on how you are assigning your data row into variables and we may be able to get you a fix.


#4

Dear jakelewis18, indra

Thank you very much for your help here…!
I’ve tried assigin data row as attached… I hope this limited screenshot would be sufficient for your advise…

Thank you very much…

Screenshot1

Screenshot2

Screenshot3
uipath20171115-3


#5

@Kn.opp, There might be a chance of returning a empty array of datarow (arrDataRowOfCsv3) after filtering. U are accessing an empty array with some index greater than zero, it returns this error.

Solution : Check the array count before you access it through index !

Regards,
Dominic :slight_smile:


#6

Dear 599712

Thank you very much, it was the case. I could resolve the select and assign issue.

But just wondering if I could ask other question…

When I tried to assng value, I got “Exception has been thrown by the target of an invocation” error as screen shot.
Just wondering how could I resolve this issue?

Screenshot1
uipath20171115-11

Screenshot1


#7

Try :
dataRowForNewDt(“Column1”) = “CompanyinCSV”


#8

Hi

i need to paste the values from the data table based on the condition that if the cell is empty i need to paste it.After pasting all the values it is throwing an exception (i.e) index out of range exception.As am new to uipath,how to check whether the values are there in the input data table.if the value is there in collection it should go and paste or else it should break.Help me out of this


Thanks,
Niranjanaa