web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Select statment from a...
Power Automate
Answered

Select statment from a Filter Array

(0) ShareShare
ReportReport
Posted on by

Hi,

im runing a flow which suppose to get a list of items from excel than im filtering it with Filter array.

i want now to select a subset of the columns and cant find the right syntex for that, first i tried to use 

"Owner":"@body('Filter_Owner')?['Owner']?['Value']"

i got following error:

InvalidTemplate. The execution of template action 'Select_2' failed: The evaluation of 'query' action 'where' expression '{ "Owner": "@body('Filter_array')['Owner']", "Status": "@body('Filter_array')['Status']" }' failed: 'The template language expression 'body('Filter_array')['Owner']' cannot be evaluated because property 'Owner' cannot be selected. Array elements can only be selected using an integer index. Please see https://aka.ms/logicexpressions for usage details.'.

 

i saw a suggestion in the forum to use following syntax:

"Owner":"@item()?['Owner']?['Value']

but it also not working, getting the following error:

InvalidTemplate. The execution of template action 'Select_2' failed: The evaluation of 'query' action 'where' expression '{ "Owner": "@item()['Owner ']['Value']", "Status": "@item()['Status']['Value']" }' failed: 'The template language expression 'item()['Owner ']['Value']' cannot be evaluated because property 'Owner ' doesn't exist, available properties are '@odata.etag, ItemInternalId, Risk ID, Area​, Team Res_x002e_​, Owner​, Mail, Status, Description​, Severity​ (1-5)​, Probability​ (1-5)​, Rating​ (S x P)​, Mitigation​, Contingency​, Comments​, __PowerAppsId__'. Please see https://aka.ms/logicexpressions for usage details.'.

 

 

it said that property owner dosent exist although it is mentioned on the propery list afterward...

any suggestions?

 

regards,

Eyal

Categories:
I have the same question (0)
  • faustocapellanj Profile Picture
    1,662 on at

    Hi @Perez

     

    Since you are already using the "Data Operations - Filter Array" action, you can follow it with a "Data Operations - Select" action to select the subset of columns you want from the Excel data. There was a thread that I replied to recently that had a similar requirement. Here's the link to the thread Send Email based on record value (Custom Flow). The information I mentioned above can be found in my second reply to the post.

     

    Please let us know if you have any questions. Thank you.

  • EP-29071004-0 Profile Picture
    on at

    Hi @faustocapellanj,

    in my flow i have a select action following the filter array, but im not sure what expression i should put in the select, i showed in my inital post two options i tried, each of them produce an error, i listed it also.

    i need to know what syntex to use in my select statement..

    attaching also screenshot of the relvant part of the flow:

    follow up.png

     

    would be great if you can assist with this.

     

    thanks in advance,

    Eyal

  • faustocapellanj Profile Picture
    1,662 on at

    Hi @Perez

     

    I see you already have your keys in the Select action. To add the value to each key, click inside the Enter value field and the Dynamic content window will open. From there you can select the value for Owner and Status. The screenshot below is just an example of your scenario.

    SelectAction.JPG

     

    If you would like a more thorough example, please provide all the info on the columns you are using in Excel and what your Create HTML Table format looks like so I can build a full Flow on my end.

     

    Thank you.

  • v-xida-msft Profile Picture
    Microsoft Employee on at

    Hi @Perez,

     

    Could you please share a full screenshot of your flow's configuration?

    Could you please show more details about your Excel table?

     

    The error message told that the Owner property could not detected within your Excel table. Please check if the Owner column is existed in your Excel table.

     

    I have created a Excel table on my side and the data structure of it as below:19.JPG

     

    I agree with @faustocapellanj's thought almost, I have made a test on my side and don't have the issue that you mentioned, please take a try with the following workaround:20.JPG

    Within "Filter array" action, left input box set to following formula:

    formatDateTime(item()?['Due_x0020_Date'],'MM/dd/yyyy')

    right input box set to following formula:

    utcNow('MM/dd/yyyy')

    Within Middle drop down, choose is greater than.

     

    Within "Select" action, From set to output of the "Filter array" action. Within Map entry, type two entries. The Key name of first entry set to TaskName and corresponding value set to following formula:

    item()?['TaskName']

    The Key of name of second entry set to Owner and corresponding value value set to following formula:

    item()?['Owner']

    Note: On your side, please use the following formula to reference column value within your Excel table:

    item()?['ColumnNameOfYourExcelTable']

    The flow works successfully as below:21.JPG

     

     

    More details about using expression in flow actions, please check the following article:

    Use expression in flow actions

     

    If the issue still exists, please consider take a try to re-create your Excel file (the data of it has been formatted as an table) and re-choose it within the "Get rows" action of your flow, then try your flow again to check if the issue is solved.

     

     

    Best regards,

    Kris

     

     

  • EP-29071004-0 Profile Picture
    on at

    Hi @v-xida-msft and @faustocapellanj,

     

    im attaching the flow configuration and results, hope it will be more clear, sorry for the very long reply...

     

     

     

     

     configuration screenshots:

    1. in the Select action idefined the Owner

    2. Compose expression: union(body('Select'),body('Select'))

    Flow#1.png

     

    3. filter expression: first(variables('OwnerArray'))?['ItOwner']

    4. in the second select i defined two fields as test

    Owner expression: @item()?['Owner']

    Status expression: @item()?['Status']

     

     

    Filter.png

    5. Send an email:

    To expression: first(body('Filter_array'))?['Mail']

    Subject expression: Open AIs formatDateTime(utcNow(),'dd/MM/yyyy')

     

     HTML.png 

     

    6. Compose expressionskip(variables('OwnerArray'),1)

     

    compose.png

     

    results screenshots:

    1. as you can see on the Select Output the owner is exist, dosen't it mean it was retrieved correctly from the excel?

    Reccure.png 

     

    result3.png

     

    2. Filter results are as expected filtering only the items from excel with the first owner from the array

    3. in the select it gives the error

     

    result#2.png 

     

    im attaching again the two options i tried to populate in the select and the corresponding error messages:

    1. 

    "Owner":"@body('Filter_Owner')?['Owner']?['Value']"

    i got following error:

    InvalidTemplate. The execution of template action 'Select_2' failed: The evaluation of 'query' action 'where' expression '{ "Owner": "@body('Filter_array')['Owner']", "Status": "@body('Filter_array')['Status']" }' failed: 'The template language expression 'body('Filter_array')['Owner']' cannot be evaluated because property 'Owner' cannot be selected. Array elements can only be selected using an integer index. Please see https://aka.ms/logicexpressions for usage details.'.

     

    2.

    "Owner":"@item()?['Owner']?['Value']

    but it also not working, getting the following error:

    InvalidTemplate. The execution of template action 'Select_2' failed: The evaluation of 'query' action 'where' expression '{ "Owner": "@item()['Owner ']['Value']", "Status": "@item()['Status']['Value']" }' failed: 'The template language expression 'item()['Owner ']['Value']' cannot be evaluated because property 'Owner ' doesn't exist, available properties are '@odata.etag, ItemInternalId, Risk ID, Area​, Team Res_x002e_​, Owner​, Mail, Status, Description​, Severity​ (1-5)​, Probability​ (1-5)​, Rating​ (S x P)​, Mitigation​, Contingency​, Comments​, __PowerAppsId__'. Please see https://aka.ms/logicexpressions for usage details.'.

     

    if something is not clear in my request i will be happy to farther elaborate.

    thanks in advance

    Eyal

  • faustocapellanj Profile Picture
    1,662 on at

    Hi @Perez

     

    I think this flow is getting over-complicated. Let's do this: how about we go back to square one. Can you please provide the structure of your Excel sheet, with columns and some sample data? Also, please provide what you are trying to achieve with this flow. Once you outline your scenario, we can provide you with a better solution.

     

    Regards

  • EP-29071004-0 Profile Picture
    on at

    Hi @faustocapellanj,

    sure, let's try that.

    i have an excel with list of project risks, where each risk has an owner which is responsible for it. i want that once a week a reminder mail will be sent to the owner containing all the risks assigned to him.

    below is sample of the data have in the excel:

    Risk with Filter.png

     

    so if risks # 1,2 are assigned to me, and its status is not closed or cancel, i will get a mail saying:  "Hi, you got these risks opened for you to handle"

    with a table containing:

    Risk ID ; Team Res. ; Status ; Description ; Rating (S*P) ; Comments

     

    hope this is helpful.

     

    thanks again for the effort.

    regards,

    Eyal

     

  • Verified answer
    faustocapellanj Profile Picture
    1,662 on at

    Hi @Perez

     

    Apologies for the long delay on the reply. I was able to put a Flow together based on the latest information you provided. There's a long post coming, so before I outline the steps, I have to mention that I rename all the steps for readability, but I'll mention the action name so you know which one to choose. Here are the steps:

     

    1. In my Flow, I'm using a Manually trigger a flow trigger.
    2. For the next step, add an Excel - Get rows action. Select your File name and the Table name. My Excel file is located in OneDrive.
      Select-1.JPG
    3. For the next step, add a Data Operations - Filter array action - renamed to Filter Tasks By Status. In the From field, select the value from the Get Rows step. For the condition, click on Edit in advance mode and enter the expression below. This expression filters the results from the Get Rows step to retrieve the items which Status is not equals to Closed and Cancelled.
      @and(not(equals(item()?['Status'], 'Closed')),not(equals(item()?['Status'], 'Cancelled')))

      Select-2.JPG
    4. For the next step, add an Initialize variable step - renamed to Initialize arrayOwnersEmail Variable. Set the Name to arrayOwnersEmail, the Type to Array, and the Value to [ ]. <-- I added spaces to the brackets here for readability, but space is not needed.
      Select-3.JPG
    5. For the next step, add an Apply to each step - renamed to ForEach Owner. Set the Output field to the Body output from step 3 above: Filter Tasks By Status.
      Select-4.JPG
    6. Inside the ForEach Owner step, add a Data Operations - Compose step - renamed to Union Owners Email Arrays. Set the Inputs field to the expression below by selecting the Expression tab from the Dynamic content window.
      union(variables('arrayOwnersName'), createArray(item()?['Owner']))

      Select-5.JPG
    7. Next, add a Variables - Set variable step - renamed to Set arrayOwnersEmail Variable. In the Name field, select the arrayOwnersEmail variable and set the Value to the Output from the Union Owners Email Arrays step.
      Select-6.JPG
    8. For the next step, add another Apply to each separate from the one in step 5 above - renamed to ForEach Unique Owner. Set the Output field to the arrayOwnersEmail variable.
      Select-7.JPG
    9. Inside the ForEach Unique Owner step, add a Data Operations - Compose step - renamed to Owners Email. Set the Inputs field to the Current item from the arrayOwnersEmail variable.
      Select-8.JPG
    10. Next, add a Data Operations - Filter array step - renamed to Filter Task By Owners Email. In the From field, select the Body from the Filter Tasks By Status step. For the condition, set left field to the item()?['Email'] expression and check if is equal to the Output from the Owners Email step.
      Select-9.JPG
    11. Next, add a Data Operations - Select - renamed to Select Task ID. Set the From field to the Body output from the Filter Task By Owners Email. Set the Map key to Task ID and the value to item()?['Title'].
      Select-10.JPG
    12. Next, add a Create HTML Table step. This is to format the email body with all the pertaining tasks for each user. Set the From field to the Output from the Select Task ID step.
      Select-11.JPG
    13. And for the last step, add an Office 365 Outlook - Send an email step. Set the To field to the Output from the Owners Email step. For the Subject, you can set what you actually need there. And for the Body, add the Output from the Create HTML Table step.
      Select-12.JPG

    Please try the outlined steps above and let us know the results.

     

    Regards,

  • GabrielStJohn Profile Picture
    Microsoft Employee on at

    Hello, @Perez!

     

    Have you had a chance to apply @faustocapellanj‘s recommendation to adapt your Flow? If yes, and you find that solution to be satisfactory, please go ahead and click “Accept as Solution” so that this thread will be marked for other users to easily identify!

     

     

    Thank you for being an active member of the Flow Community!

     

    -Gabriel

    Flow Community Manager

     

  • EP-29071004-0 Profile Picture
    on at

    Hi @GabrielStJohn,

    didnt have chance yet to try it, but as soon as i will i will post back.

    thanks,

    Eyal

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the April Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Vish WR Profile Picture

Vish WR 796

#2
Valantis Profile Picture

Valantis 568

#3
Haque Profile Picture

Haque 538

Last 30 days Overall leaderboard