cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
pladavm
Level 8

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
Super User
Super User

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
Super User
Super User

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.

pladavm
Level 8

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. 

Super User
Super User

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?

pladavm
Level 8

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

Super User
Super User

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.

pladavm
Level 8

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. 


 

 

Super User
Super User

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

pladavm
Level 8

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

Amazing @Pieter_Veenstra thank you very much. 

Helpful resources

Announcements
thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

firstImage

Incoming: New and improved badges!

We've given our badges an overhaul and also added some brand new ones!

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

sixthImage

Power Platform World Tour

Find out where you can attend!

seventhimage

Webinars & Video Gallery

Watch & learn from the Power Automate Community Video Gallery!

Top Kudoed Authors (Last 30 Days)
Users online (6,412)