cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Helper V
Helper V

Array elements can only be selected using an integer index.

Hi Everyone,

I am confused by this error: "InvalidTemplate. Unable to process template language expressions in action 'Compose' inputs at line '1' and column '2496': 'The template language expression 'items('Apply_to_each_2')['type']' cannot be evaluated because property 'type' cannot be selected. Array elements can only be selected using an integer index. Please see https://aka.ms/logicexpressions for usage details.'." Any Assistance will be much appreciated.



flowerror.png
This is folder contains all the files including import files for the custom connect and the flow expression logic
JSON Schema & JSON Data & Flow Logic Expression & Custom Connector Files Here


And I was trying to select "type" item field:
flowerrortype.JPG

I have tried numerous variations of the JSON Schema but still can't work it out. If you are able to help I would be grateful. 

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted

Re: Array elements can only be selected using an integer index.

If the top level of the array only contains 1 item and only ever contians one item them [0] will select that first/only item.

View solution in original post

8 REPLIES 8
Highlighted

Re: Array elements can only be selected using an integer index.

Can you put the Body used by the Apply to each in a Compose step just before the Apply to Each 2. Then run it again and check the value of the body.

Highlighted
Helper V
Helper V

Re: Array elements can only be selected using an integer index.

Hi @Pieter_Veenstra thank you for your reply. Do you mean something like this?

Capture.JPG

Unfortunately I still get the same error:
Capture2.JPG


Are you able to try on your end? The link in my previous post gives you all the files you need to import the Flow logic and connector. 

Highlighted

Re: Array elements can only be selected using an integer index.

In your latest scren shot I'mafter the output from Compose2. Can you click that one open and check what the out put gives you?

Highlighted
Helper V
Helper V

Re: Array elements can only be selected using an integer index.

Hi @Pieter_Veenstra thank you for your reply. Here is the Compose 2 data: Click Here for Data

Compose 2 data.JPG

Highlighted

Re: Array elements can only be selected using an integer index.

Ok, looking at the output it looks like Compose gives you an array of data  (json is starting with [ and ending with ].

 

Looking at the type of each item there though you get a type of 11 rather than your type of integer. Potentially the Current item could be feding another Apply to each, however I'm not sure that you got the right data.

 

I tried loading your solution but the customconnector is sturggling to load. Some dependency must be missing.

Highlighted
Helper V
Helper V

Re: Array elements can only be selected using an integer index.

Hi @Pieter_Veenstra the Array data is a list of transactions assigned to an account. 

Its something to do with the Schema definition see: Click Here this is the definition I have used.

Actually the first time you use it, it does take a while to connect for some reason. But after the first time, its very quick. Myself and another had the same issue the first time too. Try again after a few minutes. 


 

 

Highlighted

Re: Array elements can only be selected using an integer index.

If the top level of the array only contains 1 item and only ever contians one item them [0] will select that first/only item.

View solution in original post

Highlighted
Helper V
Helper V

Re: Array elements can only be selected using an integer index.

Amazing @Pieter_Veenstra thank you very much. 

Helpful resources

Announcements
FirstImage

Microsoft Ignite 2020

Check out the announcement of Power Platform content at Microsoft Ignite!

thirdImage

Experience what's new for Power Automate

Join us for an in-depth look at the new Power Automate features and capabilities at the free Microsoft Business Applications Launch Event.

firstImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (3,846)