cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
New Member

Expression Error: cannot be evaluated because array index '1' is outside bounds (0, 0) of array.

I have created a flow that basically takes data from a filled out form, sends and approval email, if approved it adds an entry to a spreadsheet/table. The 1st row in the table is for PO numbers (the column is named PO). In the flow, I use the following expression to increment the PO number by 1 every time the request is approved and gets added to the spreadsheet. The PO numbers are like 'ER100,' so the next PO number would be ER101 and so on.

 

The expressions is the following:

 

ADD(INT(Split(last(body('List_rows_present_in_equipment_table')?['value'])['PO'], 'R')[1]), 1)

 

Honestly, I made that expression about a year ago, and I had to spend a good amount of time researching how to get it to do what I wanted, so I really can't remember exactly how that expression works at this point.

 

It worked initially, and then worked for about 8 months or so without issue. Then I had the first issue in which the error was:

Unable to process template language expressions in action 'Increment_PO_Number_from_Equip_Table_and_Save_as_Integer' inputs at line '1' and column '2159': 'The template language expression 'ADD(INT(Split(last(body('List_rows_present_in_equipment_table')?['value'])['PO'], 'R')[1]), 1)' cannot be evaluated because array index '1' is outside bounds (0, 0) of array. Please see https://aka.ms/logicexpressions for usage details.'.

 

At that time, I copied the flow (per some article that I read), and the newly copied flow worked perfectly without any changes to it.

 

Then a couple of weeks later, I started getting the same error again sporadically. Most of the time it works, but every so often, one run will fail with this error message.

 

I was hoping someone here would be able to help me figure out what that error message is saying exactly.

 

The spreadsheet is touched multiple times daily by staff members, so its possible that there is user interference going on, but I can't figure out what they could be doing to the spreadsheet to cause this issues.

 

This is also my first time posting here, so I'm not sure what all information anyone will need to be able to try and help, but I am of course more than will to provide as much info as I can. I just don't really know how to post the whole flow. I have attached a screenshot of most of the flow, at least up until the error point.msflow.png

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support
Community Support

Hi @Sharkie405,

 

I guess this issue will happen when the PO number has no "R" in it, right?

The split() function returns an array that contains substrings, separated by commas based on the specified delimiter character in the original string.

But if the original string has no specified delimiter character, the return array will only have one member.

So the following expression, using the index [1] to get the second member will be invalid, cause there is no second member in the returned array.

Screenshot 2021-01-12 110125.jpg

 

Screenshot 2021-01-12 110153.jpg

 

As a workaround, you could add a condition to check if the original string contains "R", if it contains R, using split() function, or not do that.

 

Best Regards,
Community Support Team _ Lin Tu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

1 REPLY 1
Community Support
Community Support

Hi @Sharkie405,

 

I guess this issue will happen when the PO number has no "R" in it, right?

The split() function returns an array that contains substrings, separated by commas based on the specified delimiter character in the original string.

But if the original string has no specified delimiter character, the return array will only have one member.

So the following expression, using the index [1] to get the second member will be invalid, cause there is no second member in the returned array.

Screenshot 2021-01-12 110125.jpg

 

Screenshot 2021-01-12 110153.jpg

 

As a workaround, you could add a condition to check if the original string contains "R", if it contains R, using split() function, or not do that.

 

Best Regards,
Community Support Team _ Lin Tu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Helpful resources

Announcements
Microsoft Ignite

Microsoft Ignite

Join digitally, March 2–4, 2021 to explore new tech that's ready to implement. Experience the keynote in mixed reality through AltspaceVR!

New Super Users

Meet the Power Automate Super Users!

Many congratulations to the Season 1 2021 Flownaut Crew!

New Badges

New Solution Badges!

Check out our new profile badges recognizing authored solutions!

MPA Community Blog

Power Automate Community Blog

Check out the community blog page where you can find valuable learning material from community and product team members!

Users online (21,063)