cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
kobinaof2
Regular Visitor

Syntax on filter query

 

 

I am running into this issue in my Filter query: 

 

 

')' or ',' expected at position 26 in 'contains(cr079_name,'Lowe's Companies Inc')'.

 

 

 

I am trying to get rows based on this filter query: "contains(cr079_name,'@{items('For_each_Report_Details')?['cr079_entityname']}')"

 

I also have this action wrapped with an "apply for each" action. The overall aim is to filter that list so I can do something with it.

 

Any helps?

flowchart.PNG

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Paulie78
Super User III
Super User III

I think you are going to have to do something like this:

replace(items('For_each_Report_Details')?['cr079_entityname'],'''','''''')

in your filter rows action.

 

View solution in original post

7 REPLIES 7
Paulie78
Super User III
Super User III

It would appear that the "Entity" name contains a single quote which is being interpreted in the filter query, and therefore making the syntax incorrect.

 

I'm not sure of the solution, you might have to URLEncode the single quote or replace it with \' or perhaps double quotes. But that is what is causing your problem.

Paulie78
Super User III
Super User III

I think you are going to have to do something like this:

replace(items('For_each_Report_Details')?['cr079_entityname'],'''','''''')

in your filter rows action.

 

View solution in original post

What do you mean? Replace the contain function with the replace function? 

It seems to work. thank you but now I am running into the problem: 

One or more fields provided is of type 'Null', a different type is expected.

 

seem].PNG

 

Paulie78
Super User III
Super User III

Then you are going to have to do an even more elaborate expression to replace the null with an empty string. Can you paste me the expression you used and I will rewrite it for you.

This is what it looks like now

(contains(cr079_name,' @{replace(items('For_each_Report_Details')?['cr079_entityname'],'''','''''')}' )) OR (cr079_ticketsymbol eq '@{replace(items('For_each_Report_Details')?['cr079_ticketsymbol'],'''','''''')}')
Paulie78
Super User III
Super User III

Looks a bit crazy, but this should do it:

(contains(cr079_name,' @{replace(if(equals(items('For_each_Report_Details')?['cr079_entityname'], null), '', items('For_each_Report_Details')?['cr079_entityname']),'''','''''')}' )) OR (cr079_ticketsymbol eq '@{replace(if(equals(items('For_each_Report_Details')?['cr079_ticketsymbol'], null), '', items('For_each_Report_Details')?['cr079_ticketsymbol']),'''','''''')}')

Helpful resources

Announcements
MPA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

V3_PVA CAmpaign Carousel.png

Community Challenge - Giveaways!

Participate in the Power Virtual Agents Community Challenge

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

R2 (Green) 768 x 460px.png

Microsoft Dynamics 365 & Power Platform User Professionals

DynamicsCon is a FREE, 4 half-day virtual learning experience for 11,000+ Microsoft Business Application users and professionals.

Top Solution Authors
Users online (2,060)