Monday, September 27, 2021

Form has outer join on a datasource and user wants to filter for blank value on the outer joined table

 As you may have found, if you have a form with an outer joined datasource and a user wants to filter the form so that a value on the key field in the table is blank (in other words, you want not exists join instead of outer join), the form will show NO records returned.

This occurs because the form adds a queryFilter to the outer joined datasource. My solution was to catch this scenario and change the queryFilter to a queryRange.

Example:

On the executeQuery() method on the main datasource, I added this code.

This code will find the existing queryFilter (this one looks specifically for a blank batch number) and then add the same queryFilter to a range.