How can I filter on a relation / related foundset using a global variable. I have a colum booked in my related foundset. Also I have a global variable bookingState as filter variable for the relation. The colum booked can hold the value null or 0 for not booked and the value 1 for booked.
I need to filter my related foundset, so that I have null and 0 in my foundset if the starts the program. If the user clicks a button, also booked fields should be shown, so that my foundset have null, 0 and 1 values.
How can I realize that?
For a test I simplified the global variable filter operator to <=.
bookingState <= booked
If bookingState is set to 1, I get only booked fields with the value 1. Should not I also get 0? If bookingState is set to 9, I get also only booked fields with the value 1. Why? If bookingState is set to 0, I get fields with the value 0 and 1.
I don’t understand that behaviour? Miss I something?
deezzub:
If bookingState is set to 1, I get only booked fields with the value 1. Should not I also get 0?
I don’t understand that behaviour? Miss I something?
deezzub:
If bookingState is set to 1, I get only booked fields with the value 1. Should not I also get 0?
I don’t understand that behaviour? Miss I something?
1 <= 0 ?
Yes, wrong, but it was not my origin intention.
If I set bookingState to 9, I have also and only records with booked === 1 in my form and booked is also smaller than 9, but I see the booked records. The filter is not applied.
Are you sure you added the key to right relation then? all keys from a relation become SQL (conditions or joins)…perhaps check even the fired SQL on admin-page (tip clear SQL on admin-page before execution, makes it easier to find)
Jan Blok:
Are you sure you added the key to right relation then? all keys from a relation become SQL (conditions or joins)…perhaps check even the fired SQL on admin-page (tip clear SQL on admin-page before execution, makes it easier to find)
Yes. I found the poblem. I was because the MS SQL database field was a bit field. If I want to change the operator, then I can do this (only) using the solution model?
Even if your column was an integer, I believe this can’t be done without changing the operator with solutionModel. I had the exact same situation today. We solved it by doing a manual find() within the related foundset