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 Apps / Multiple Filters with ...
Power Apps
Unanswered

Multiple Filters with On-Prem SQL returning error or no data

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

I'm having a heck of a time applying multiple filters to my SQL table.  |The data comes from the Dynamics NAV Item table and i'm trying to filter by "Division Code" then "Item Category Code" as well as a search by "No_"

 

I have two drop down boxes. the first connected to the Division table which has the Columns "Code" (10, 20, 30, etc) and "Description" (Dining, Bedroom, etc) and the second to the Item Category table which has columns "Code" (10-001, 20-004, etc) and "Description" (Benches, Sofas, etc).

 

After much fighting, I've managed to get the second drop down to filter based on the first with the following code:

 

 

Filter(RenameColumns('[dbo].[Item Category]',"Division Code","DivisionCode"),DivisionCode=Dropdown1.Selected.Code)

 

I needed to add the RenameColumns because I couldn't get the dropdown to populate if the filter columns had a space in the name.

 

Now I'm trying to filter a gallery connected to the Item table which has over 5000 records, therefore filtering needs to be done server side. I am again running into issues with column names having spaces in them. and get the following error in my filter:

 

"The requested operation is invalid.

Server Response: ')' or operator expected at position 10 in (Division Code eq '50')and(Item Category Code eq '50-001')'.

inner exception: ')' or operator expected at position 10 in (Division Code eq '50')and(Item Category Code eq '50-001')'."

 

It seems as thought the column names are being sent to the query without quotes around them. and the spaces are breaking the syntax.

 

I've tried to compensate for it in the gallery.Items with the following, but i'm only getting results from the first 500 rows.

 

SortByColumns(Filter(RenameColumns(RenameColumns('[dbo].[Item]',"Division Code","DivCode"),"Item Category Code","CatCode"), DivCode = Dropdown1.Selected.Code && CatCode=Dropdown2.Selected.Code),"No_",Ascending)

 How can I get around this query error with spaces in the column names and have the results filtered server-side?

 

Thanks!

 

Categories:
  • rgruian Profile Picture
    Microsoft Employee on at

    Thank you for reporting this, Mindwarp.

    We are looking into this problem and we'll report back. In the mean time until the problem is fixed, the only workaround that I am aware of is to use simple column names without blanks.

    We will keep you posted.

     

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Any update on this? This is severly limiting the usefulness of the On-Prem data gateway and SQL connector for PowerApps.

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    I'm also experiencing this issue. Filtering on multiple columns when one column name has a space does not seem to work. Filtering on only one column name, even if that column name has a space, does work. 

     

    This is with a connection to Azure SQL

     

    @rgruian What is the ETA for a solution? Thanks

  • JBille Profile Picture
    43 on at

    Has this been fixed?

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 236 Super User 2026 Season 2

#2
WarrenBelz Profile Picture

WarrenBelz 207 Most Valuable Professional

#3
Mohsin Ali Profile Picture

Mohsin Ali 169

Last 30 days Overall leaderboard