cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Helper I
Helper I

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
Highlighted
Community Support
Community Support

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.
Highlighted
Helper I
Helper I

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

 

Highlighted
Community Support
Community Support

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
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

Power Platform ISV Studio

Power Platform ISV Studio

ISV Studio is designed to become the go-to Power Platform destination for ISV’s to monitor & manage published applications.

Tech Marathon

Maratón de Soluciones de Negocio Microsoft

Una semana de contenido con +100 sesiones educativas, consultorios, +10 workshops Premium, Hackaton, EXPO, Networking Hall y mucho más!

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