Scrape data and Index was outside the bounds of the array

Hello you great people of this forum. I really mean that you’ve answered soon many questions for me it’s awesome.

So i’m scraping data from a website (Cisco Call Manager) and the data i’m scraping is in a text box on the page. See below:
I can pull each line into an array with the following:
I then created several variables to store each item in the array:

Each one of these is just variable name = AssDevices(0).ToString just changing the array location on each one.
I’m then doing an if statement for each array location that moves the device i’m needing to move (from a data table) down to another text box. See below:

It should be looking to see if that data in the array location 0 matches the device name and if it does move it down. The next if statement does the same for array location 1 and so on.

The issue i’m running into is if the text box doesn’t have enough fields for all the array locations I get
Assign Fifth Device: Index was outside the bounds of the array.
Or whatever number it goes to, not always the 5th.

Is there another way for me to do this? I just need it to match the number in the data table and move it if it finds it. The only way I found to do this was to scrape the text box and match each entry with an equals if statement. It seems to work some times but not all the time.

Thanks for any help with this. It’s much appreciated.


So before to this If activities use a IF condition like this
If true it will go to THEN part where we can have all our further IF condition so that we won’t face this index error

Cheers @Nerd

Would I do this before each of these if statements?

Like this?

Sorry for the confusion.
And so on?

1 Like

Cheers @Nerd

Hmm. I still seem to be getting the error.

It should be looking for SEP00141CCDFCF5 which is in the text box

But it gives me that error.

But I hope we have only three values here right
So the output array will be having only three element and to the maximum of index 2 only should work
I wonder how the index 3 itself first worked and as there is no element in index 4 it’s giving us this error

Instead of getting that values and assign it to a variable like firstdevice, secondevice we can directly mention the index in the IF CONDITON here like this if in specific
row(“Device Name”).ToString.Equals(AssDevices(0).ToString)

Or if we are going to check for all the values in the array with different column in the datatable then we can use a FOR EACH loop where pass the AssDevice variable as input and change the type argument as string in the property panel of for each activity
—inside the loop we can keep the IF condition with current new condition and within that another IF CONDITION with this expression

Cheers @Nerd

One of the issues I’m going to have is that I don’t know how many devices will show up in the text field.
If I do
row(“Device Name”).ToString.Equals(AssDevices(0).ToString)
It’s only going to look in the first index (0) correct? If the correct device was in the first index that would work but if it’s the fourth index it would think it’s not there and move on. I would need
row(“Device Name”).ToString.Equals(AssDevices(1).ToString) and
row(“Device Name”).ToString.Equals(AssDevices(2).ToString) and so on correct?

Let me try and build it in the for each item loop you describe above and go from there using
This might be the way to do it if I can figure it out lol