cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Bee1
Frequent Visitor

Error in flow - The template language expression 'int(item()['Capacity'])' cannot be evaluated because property 'Capacity' cannot be selected. Please see https://aka.ms/logicexpressions for usage details.'.

Hi, 

 

I am trying to build a flow that needs to retrieve the capacity data for a selected equipment from an excel table stored in a Document library in SharePoint Online.  

 

The capacity data in the excel table is of number type with no decimal places. Flow needs to read the excel table and extract the equipment id and corresponding capacity data for the selected equipment. 

The extracted information will be stored in two variables - varEquipmentID (which is of string type) and varCapacity (which is of integer type). 

 

Somehow i kept encountering the following error for the action Set Variable - varCapacity.:

InvalidTemplate. Unable to process template language expressions in action 'Set_variable_capacity_' inputs at line '0' and column '0': 'The template language expression 'int(item()['Capacity'])' cannot be evaluated because property 'Capacity' cannot be selected. Please see https://aka.ms/logicexpressions for usage details.'.

 

I have converted "Capacity" to integer --> int(item()['Capacity']) due to an earlier error below

BadRequest. The variable 'varCapacity' of type 'Integer' cannot be initialized or updated with value of type 'Array'. The variable 'varCapacity' only supports values of types 'Integer'. 

 

This is my flow and excel. Would appreciate any help!!

 

Bee1_0-1656731350192.png

Bee1_1-1656731457061.pngBee1_2-1656731648291.png

Thanks in advance!!!

Bee1

 

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
ekarim2020
Super User
Super User

The output of the Select action is an array - but with a single item: 

Snag_a98e1fc.png

Try specifying the first item of the array:

 

int(first(item()?['Capacity']))

 

 


Ellis
____________________________________
If I have answered your question, please mark the post as Solved.
If you like my response, please give it a Thumbs Up.

View solution in original post

5 REPLIES 5
ekarim2020
Super User
Super User

The output of the Select action is an array - but with a single item: 

Snag_a98e1fc.png

Try specifying the first item of the array:

 

int(first(item()?['Capacity']))

 

 


Ellis
____________________________________
If I have answered your question, please mark the post as Solved.
If you like my response, please give it a Thumbs Up.

Goloknath
Frequent Visitor

Hi @Bee1 , I agree with @ekarim2020 pls try the above suggested option if still not working may be you can update here ?

Bee1
Frequent Visitor

Thanks. Ellis. Yes, your suggested solution works. Sorry for the late reply. 

Bee1
Frequent Visitor

Hi, Ellis

Appreciate if you could explain when a question mark is needed next to item() and when it is not needed in the expression. Thanks!

 

Bee1

@ekarim2020  

Helpful resources

Announcements
Register for a Free Workshop.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

September Events 2022

Check out all of these events

Attend in person or online, there are incredible conferences and events happening all throughout the month of September.

Users online (4,785)