Hey everyone, Im trying to implement a default filter for my entity b

Hey everyone,

Im trying to implement a default filter for my entity backed record and return back results where a particular field is either false or null (not true). I have tried using <> true, and or(null, false) and both are failing to return back the results I need.
Anyone have any ideas on this one?

OriginalPostID-198637

OriginalPostID-198637

  Discussion posts and replies are publicly visible

Parents
  • @benjamins As per my knowledge, here goes few approaches to solve the issue:

    1. Shifting the implementation from Entity Backed to Expression Backed. You can query the entity with the filters as desired by you as the source of the data is expression backed.

    Drawback of this approach is that the configuration is slightly time-consuming but is much advantageous in terms of flexibility.

    2. Set NULL as false in the corresponding database entity.

    If you are making use of a view, make sure that column(that hold boolean values) is able to render false in case if the column holds NULL value. (IFNULL(my_boolean_column,false) according to MySQL.)

    In case of a table being used, then update the column(that hold boolean values) in the table so that NULL is replaced by false (UPDATE my_table SET my_boolean_column = false where my_boolean_column IS NULL) and also make sure that this change is handled in the process (new + inflight instances). (Off-course, you can make your Record Type refer a data store entity based on a view instead of table, and make the view hold the same data as the table.)

    Prior to resorting for the approaches mentioned above, I would suggest you try configuring the default filters in all possible ways and also let's see if any other practitioners can suggest a simple work around for this.
Reply
  • @benjamins As per my knowledge, here goes few approaches to solve the issue:

    1. Shifting the implementation from Entity Backed to Expression Backed. You can query the entity with the filters as desired by you as the source of the data is expression backed.

    Drawback of this approach is that the configuration is slightly time-consuming but is much advantageous in terms of flexibility.

    2. Set NULL as false in the corresponding database entity.

    If you are making use of a view, make sure that column(that hold boolean values) is able to render false in case if the column holds NULL value. (IFNULL(my_boolean_column,false) according to MySQL.)

    In case of a table being used, then update the column(that hold boolean values) in the table so that NULL is replaced by false (UPDATE my_table SET my_boolean_column = false where my_boolean_column IS NULL) and also make sure that this change is handled in the process (new + inflight instances). (Off-course, you can make your Record Type refer a data store entity based on a view instead of table, and make the view hold the same data as the table.)

    Prior to resorting for the approaches mentioned above, I would suggest you try configuring the default filters in all possible ways and also let's see if any other practitioners can suggest a simple work around for this.
Children
No Data