340
Views
2
Comments
Solved
Multiple boolean variables in aggregate filter (Sql query)
Question

I have a list of many records and I want to sort this by multiple filters.

This works fine, I get a list based on which filter I set. However, when I select multiple filters that refer to the same column, I don't get any results.

My current filters are like above, plus some extra filters on other columns.

I'm looking for syntax that will basically check if the signaal2.status column = all filters that are currently selected. 


UserImage.jpg
rob knipscheer
Solution

J. wrote:

Hi,


I think you should do this in one filter and more like

(Session.Signalen_geregeld = False or (Signaal2.Status = "Geregeld" and Session.Signalen_geregeld = True))
OR
(Session.Signalen_XXX = False or (Signaal2.Status = "XXX" and Session.Signalen_XXX = True))


So this didn't work, but gave me an idea. I found it works like this: 

(Signaal2.Status = "Geregeld" and Session.Signalen_Geregeld = True) or
(Signaal2.Status = "XXX" and Session.Signalen_XXX = True) or

Etc. I also put a statement in the same filter that checks if all session variables are false, so the full list gets shown. when there is no filter selected.

Thanks for the help!


2016-04-21 20-09-55
J.
 
MVP

Hi,


I think you should do this in one filter and more like

(Session.Signalen_geregeld = False or (Signaal2.Status = "Geregeld" and Session.Signalen_geregeld = True))
OR
(Session.Signalen_XXX = False or (Signaal2.Status = "XXX" and Session.Signalen_XXX = True))

because the seperate filters are "AND" filters.

which means you get

(Session.Signalen_geregeld = False or (Signaal2.Status = "Geregeld" and Session.Signalen_geregeld = True))
AND
(Session.Signalen_XXX = False or (Signaal2.Status = "XXX" and Session.Signalen_XXX = True))

which result to no records, because no Status is equeal to "Geregeld" and "XXX"

UserImage.jpg
rob knipscheer
Solution

J. wrote:

Hi,


I think you should do this in one filter and more like

(Session.Signalen_geregeld = False or (Signaal2.Status = "Geregeld" and Session.Signalen_geregeld = True))
OR
(Session.Signalen_XXX = False or (Signaal2.Status = "XXX" and Session.Signalen_XXX = True))


So this didn't work, but gave me an idea. I found it works like this: 

(Signaal2.Status = "Geregeld" and Session.Signalen_Geregeld = True) or
(Signaal2.Status = "XXX" and Session.Signalen_XXX = True) or

Etc. I also put a statement in the same filter that checks if all session variables are false, so the full list gets shown. when there is no filter selected.

Thanks for the help!


Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.