Bellow is the error I am getting?
Hi @balkishan
I don’t think that the array you’re working on FullTxtArray
doesn’t contain the index you’re trying to assign to the variable Address
.
I don’t know how did you get the FullTxtArray but I would suggest put a message box or a write line in a for each to be able to see each element is there and then you can precede by assigning them.
Hope it helps,
Reda
I guess what you are doing is using assign activity to get some value from an array element.
consider your array sampleArray
has only 5 elements, index ranges from 0 - 4.
if you are trying to access sampleArray(5)
or sampleArray(6)
or more, you would have this error.
Hope this helps
@kaderms yes you got the point, Actually I am fetching data from the invoices but I need specific line of data, Everything is working fine but the issue in the the Line is not constant and in some invoices it’s three lines and in some lines it’s 4 lines. So the error is occur, can you tell me how can I resolve this.
Where does the array come into picture? Is it something that you have chosen to use or is it a result of some activity?
@kaderms No bro, I have created the array to split the value. below is the snapshot where it’s clearly described.
I have put this value in a string and the put into an array to split the line to get the particular line of value. Here I marked the three lines.
In the other process I have used the string manipulation correctly and get the expected result. But when I copy into the main process I am get the array out of bound.
So your problem is sometimes the address turns out to be just two lines? Instead of three?
Does this perspective work for you? -
First line is the name
Last line is the po box no
Whatever lies in between would be the address.
@kaderms exactly bro. Because the issue with the Address in some invoice it becomes 2-3. Suppose I have selected the array index for PO is 5 but when the address becomes 3 lines so PO also becomes 6 lines. That case I get this error.
Yes First line for Name and the Last line for PO Number only.
Perfect. Here is your solution.
Consider your scraped set of lines is strAddressLines
after splitting with new line, consider the array is arrayOfAddressLines
name = arrayOfAddressLines(0)
poBoxNo = arrayOfAddressLines(ubound(arrayOfAddressLines))
address = strAddressLines.Replace(name, "").Replace(poBoxNo , "").Trim