chozma
Member
Hi guys,
I'm trying to add some pre-filters to a list I have. The list contains data about animals and is joined with three other tables. I've got lots of pre-filters going on that all work brilliantly but I need to add an additional pre-filter to one of the groupings I have.
At the moment the grouping I want to expand on selects records that:
* have a field called 'current' which equals 1 for each record with a specific id
or
* has no mention of a specific id
Now if either of those conditions fail I also want it to select:
* the max date from a field called 'joined' for all records that have a specific id and have 'current' set to 0.
So I've added the last pre-filter as an OR and grouped it as per the attached image.
So you can see more specifically the code I have used in the prefilters above, here are the queries:
OR
OR
Its not doing what I would expect as it seems to be treating the last statement as though it was an AND.
I can't figure out how to extract the SQL to see what's going on.
I've tried using debug mode but all it lets me see is the data structure for joins and no SQL.
What do you think might be going on here? Some advice would be great as I'm all out of new ideas on how to approach this one!
Kind regards,
Hannah
x
I'm trying to add some pre-filters to a list I have. The list contains data about animals and is joined with three other tables. I've got lots of pre-filters going on that all work brilliantly but I need to add an additional pre-filter to one of the groupings I have.
At the moment the grouping I want to expand on selects records that:
* have a field called 'current' which equals 1 for each record with a specific id
or
* has no mention of a specific id
Now if either of those conditions fail I also want it to select:
* the max date from a field called 'joined' for all records that have a specific id and have 'current' set to 0.
So I've added the last pre-filter as an OR and grouped it as per the attached image.
So you can see more specifically the code I have used in the prefilters above, here are the queries:
Code:
app_mob_animal_Mob
EQUALS
SELECT Mob
FROM app_mob_animal
WHERE app_animal.id = app_mob_animal.animal AND app_mob_animal.current = '1'
OR
Code:
app_mob_animal_Animal IS NULL
OR
Code:
app_mob_animal_Joined
EQUALS
SELECT MAX(Joined)
FROM app_mob_animal
WHERE app_animal.id = app_mob_animal.animal AND app_mob_animal.current = '0'
Its not doing what I would expect as it seems to be treating the last statement as though it was an AND.
I can't figure out how to extract the SQL to see what's going on.
I've tried using debug mode but all it lets me see is the data structure for joins and no SQL.
What do you think might be going on here? Some advice would be great as I'm all out of new ideas on how to approach this one!
Kind regards,
Hannah
x