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

  • @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.
  • 0
    Certified Lead Developer
    over 7 years ago
    Could you use an operator of "in" and a value of {false, null} ?
  • 0
    Certified Lead Developer
    over 7 years ago
    Having that option might depend on your Appian version though...
  • @philb I am on Appian 16.1, and prior to posting my solution I have made few tests. What I have observed is, {null, true} worked excellently whereas {null,false} didn't. And as said by you, I remember doing a similar test long ago (on 7.5 or 7.6 I guess) has resulted in error.
  • @philb Using the IN operator with {null, false} returns back false only.

    Im thinking of setting everything in the database to false and then tweaking my existing live instances so when I persist the CDT changes to the database, checking for null for the CDT field and if it is null, then retrieving the value from the database and setting the CDT to that, else, having a default setting to false.
  • @benjamins Might be worth trying {false,null} as said by @philb? Unfortunately all these kind of stuff are based on trail and error as there isn't a standard way of doing.
  • {false, null} or {null, false}, both fail to return back null fields.
  • 0
    Certified Lead Developer
    over 7 years ago
    How about "not in" and {true} ...?
  • @philb My personal experience was, it didn't work for me. I have tried various combinations prior to posting the solution, surprisingly none of them worked as {null, true}. I thought that some practitioner might have had a hack.
  • 0
    Certified Lead Developer
    over 7 years ago
    I guess I was reading the requirement as to show anything that isn't true - so "not in" {true} would fit that?