Assign: Index was outside the bounds of the array. Please help!

Hi All,

I am using below code. I wanted to extract either order ID or invoice ID or sometimes both from an .xml file. But it is giving below error:
Assign: Index was outside the bounds of the array.

If anybody can help??
Attaching all relevant document…plz help
New…xaml (19.4 KB)
Data used here:
Data.zip (3.7 KB)

P.S. Run the code u will see the error

This means you are trying to reference an item in a collection that doesn’t exist. Say there are 5 items in the collection (index 0-4) and you try to reference item(5) - you’ll get this error.

1 Like

Array value is start index is Zero(0).

ArrValue(ArrValue.Length-1) to get last value.

Regards,
Arivu

1 Like

Hi,

The expression try to iterate 2 items from arr1.length. However arr2 and arr3 has only 1 item, then throw exception. Perhaps you should review your expression.

Regards,

How it can be done…if u can help?

Which part u r talking about specifically in code?

Hi,

I’m not sure what you want to do by this expression. However, for now, can you try to modify from arr1.length to arr2.length, as the following?

(From x In Enumerable.Range(0,arr2.length)
Let a = "LabelA: " & arr1(x)
Let b = "LabelB: " & arr2(x)
Let c = "LabelC: " & arr3(x)
Select res = String.Join(Environment.newLine, {a,b,c})).toarray

Regards,

1 Like

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