cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Perez
Level: Powered On

Select statment from a Filter Array

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

20 REPLIES 20
Super User
Super User

Re: Select statment from a Filter Array

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.


Fausto Capellan, Jr


Did I answer your question? Mark my post as a solution! Did my response help? Please give it a thumbs up!

Proud to be a Flownaut!


Perez
Level: Powered On

Re: Select statment from a Filter Array

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

Super User
Super User

Re: Select statment from a Filter Array

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.


Fausto Capellan, Jr


Did I answer your question? Mark my post as a solution! Did my response help? Please give it a thumbs up!

Proud to be a Flownaut!


Community Support Team
Community Support Team

Re: Select statment from a Filter Array

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

 

 

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Perez
Level: Powered On

Re: Select statment from a Filter Array

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

Super User
Super User

Re: Select statment from a Filter Array

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


Fausto Capellan, Jr


Did I answer your question? Mark my post as a solution! Did my response help? Please give it a thumbs up!

Proud to be a Flownaut!


Perez
Level: Powered On

Re: Select statment from a Filter Array

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

 

Super User
Super User

Re: Select statment from a Filter Array

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,


Fausto Capellan, Jr


Did I answer your question? Mark my post as a solution! Did my response help? Please give it a thumbs up!

Proud to be a Flownaut!


Administrator
Administrator

Re: Select statment from a Filter Array

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

 

-Gabriel
Microsoft Flow Community Manager
Perez
Level: Powered On

Re: Select statment from a Filter Array

Hi @GabrielStJohn,

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

thanks,

Eyal

Perez
Level: Powered On

Re: Select statment from a Filter Array

Hi @faustocapellanj,

sorry for the long delay, just now had a chance to try ytour suggestion.

i tried to implement it and got stuck on step 6.

when trying to build the compose expression it givess the following error:

Initialize Variable.png

 

copy it into the input line it just read it as a string.

 

any ideas?

 

 

thanks in advance,

Eyal

Super User
Super User

Re: Select statment from a Filter Array

Hi @Perez

 

It seems you are copying the expression without setting up the variable step. Can you please post a screenshot of your flow so I can take a look? Also, please review all the steps I provided in my previous post to make sure you didn't forget anything.

 

Regards,


Fausto Capellan, Jr


Did I answer your question? Mark my post as a solution! Did my response help? Please give it a thumbs up!

Proud to be a Flownaut!


Perez
Level: Powered On

Re: Select statment from a Filter Array

Hi @faustocapellanj,

actually i followed your flow step by step, but it didnt passed that step, please see screenshot below:

 

union.pngunion#2.png

and the error im getting is:

 

Initialize Variable.png

 

it is not even in run time, but when im trying to save the flow.

 

thanks in advance

Eyal

 

Super User
Super User

Re: Select statment from a Filter Array

Hi @Perez

 

My apologies. I honestly don't know how I missed a step in the instructions I provided before. There should be 2 variables, but I only posted one. I have added screenshots with all the steps for the Flow. Again, my most sincere apologies.

 

Select-13.JPGFilter and VariablesSelect-14.JPGFirst Apply to Each

Select-15.JPGSecond Apply to Each


Fausto Capellan, Jr


Did I answer your question? Mark my post as a solution! Did my response help? Please give it a thumbs up!

Proud to be a Flownaut!


Perez
Level: Powered On

Re: Select statment from a Filter Array

Hi @faustocapellanj,

wow, it worked perfectly, thanks a lot for that.

i got a mali notification with the Risk IDs assigned to me.

i tried now to add additional fields to the mail but got ann error saying that the fields are not recognized, please seee below:

 

Select#1.pngSelect#2.png

 

as you can see in the error text and picture the value does exist in the input:

InvalidTemplate. The execution of template action 'Select_Risk_ID' failed: The evaluation of 'query' action 'where' expression '{
  "RiskID": "@item()['Risk ID']",
  "Area": "@item()['Area']",
  "Owner": "@item()['Owner']",
  "Status": "@item()['Status']",
  "Description": "@item()['Description']"
}' failed: 'The template language expression 'item()['Area']' cannot be evaluated because property 'Area' 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.'.

 

do you see any issue with how i put it?

 

regards,

Eyal

Super User
Super User

Re: Select statment from a Filter Array

Hi @Perez

 

How are you entering the expression for the item? Like this item()?['Area'] ?


Fausto Capellan, Jr


Did I answer your question? Mark my post as a solution! Did my response help? Please give it a thumbs up!

Proud to be a Flownaut!


Perez
Level: Powered On

Re: Select statment from a Filter Array

Hi @faustocapellanj,

im just typing it in the expression field

Super User
Super User

Re: Select statment from a Filter Array

Hi @Perez

 

I see that the additional properties, such as Area, are available for selection. I was able to select those additional properties in my Flow; you can see the step and the results in the screenshots below:

Select-16.JPGAction with Expression

Select-17.JPGOutput

Please check the expressions for the properties to make sure it matches the expression in the screenshot above and let me know.

 


Fausto Capellan, Jr


Did I answer your question? Mark my post as a solution! Did my response help? Please give it a thumbs up!

Proud to be a Flownaut!


Perez
Level: Powered On

Re: Select statment from a Filter Array

Hi @faustocapellanj,

actually I put it exactly the way you showed in the expression field, it’s very weird because for the 'Risk ID' and 'Status' fields, it is ok, if I’m running the flow only  with these two it works but when trying to add in 'Description', 'Owner',  and 'Area' it gives the error I attached below.

any idea?

 

thanks 

Eyal

Helpful resources

Announcements
firstImage

Microsoft Business Applications Virtual Launch Event

Watch the event on demand for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

firstImage

Watch Sessions On Demand!

Continue your learning in our online communities.

Power Platform 2019 Release Wave 2 Plan

Power Platform 2019 Release Wave 2 Plan

Features releasing from October 2019 through March 2020.

thirdimage

Flow Community User Group Member Badge

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

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 Flow Community Video Gallery!

Users Online
Currently online: 464 members 5,301 guests
Please welcome our newest community members: