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

Start and end dates

Trying to filter a

 

InvalidTemplate. The execution of template action 'Selection' failed: The result '"False"' of the evaluation of 'query' action 'where' expression '"@{and(greaterOrEquals(item()?['Start_x0020_Date'], outputs('StartofMonth')),lessOrEquals(item()?['End_x0020_Date'], outputs('EndofMonth')))}"' is not a valid boolean value.

3 REPLIES 3
Community Support Team
Community Support Team

Re: Start and end dates

Hi @djw1005,

 

Would you please share about where you are putting the following code to?

"@{and(greaterOrEquals(item()?['Start_x0020_Date'], outputs('StartofMonth')),lessOrEquals(item()?['End_x0020_Date'], outputs('EndofMonth')))}"

If it is added to the Action InputBox, then there would be double quotes added with the actual result, which would then result in a string type.

Please consider add a compose Action, and with the Compose Input, copy and paste the following:

"@and(greaterOrEquals(item()?['Start_x0020_Date'], outputs('StartofMonth')),lessOrEquals(item()?['End_x0020_Date'], outputs('EndofMonth')))"

After that, use the Compose Output as the Input value.

If this still not working, then please share a screenshot of your Flow configuration details.

Regards,

Michael 

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

Re: Start and end dates

 

This is the flow that I am trying to create, I have put the code in the filter, if I put the code in a compose as suggested then that can't be used as a selection

 Flow.JPG

 

Community Support Team
Community Support Team

Re: Start and end dates

Hi @djw1005,

 

Thanks for the update.

If the code is used under Filter Query, then please remove the double quotes.

Besides, make sure the string are all in date type.

You may consider add the formatDateTime function with each date elements:

 

@and(
greaterOrEquals(
formatDateTime(item()?['Start_x0020_Date'],'yyyy/MM/dd'),
formatDateTime(outputs('StartofMonth'),'yyyy/MM/dd')
),
lessOrEquals(
formatDateTime(item()?['End_x0020_Date'], 'yyyy/MM/dd'),
formatDateTime(outputs('EndofMonth'),'yyyy/MM/dd')
)
)

Regards,

Michael

Community Support Team _ Michael Shao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
firstImage

Incoming: New and improved badges!

Look out for new contribution recognition badges coming SOON!

firstImage

Power Platform Online Conference

Join us for the first ever Power Platform Online Conference!

firstImage

New & Improved Power Automate Community Cookbook

We've updated and improved the layout and uploading format of the Power Automate Cookbook!

thirdimage

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

Top Solution Authors
Top Kudoed Authors
Users online (5,569)