Appian Community
Site
Search
Sign In/Register
Site
Search
User
DISCUSS
LEARN
SUCCESS
SUPPORT
Documentation
AppMarket
More
Cancel
I'm looking for ...
State
Suggested Answer
+1
person also asked this
people also asked this
Replies
12 replies
Answers
1 answer
Subscribers
13 subscribers
Views
5466 views
Users
0 members are here
Share
More
Cancel
Related Discussions
Home
»
Discussions
»
Data and Records
Hey everyone, Im trying to implement a default filter for my entity b
benjamins
over 8 years ago
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
Top Replies
michszym
over 1 year ago
+2
suggested
Certified Associate Developer
Use a custom field and add a default value to it a!customFieldDefaultValue( value: 'recordType.booleanFieldWithNulls', default: false ) Name it something like fieldName + "NullSafe", and then filter…
0
sikhivahans
over 8 years ago
@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.
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
PhilB
A Score Level 1
over 8 years ago
Could you use an operator of "in" and a value of {false, null} ?
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
PhilB
A Score Level 1
over 8 years ago
Having that option might depend on your Appian version though...
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
sikhivahans
over 8 years ago
@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.
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
benjamins
over 8 years ago
@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.
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
sikhivahans
over 8 years ago
@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.
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
benjamins
over 8 years ago
{false, null} or {null, false}, both fail to return back null fields.
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
PhilB
A Score Level 1
over 8 years ago
How about "not in" and {true} ...?
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
sikhivahans
over 8 years ago
@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.
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
PhilB
A Score Level 1
over 8 years ago
I guess I was reading the requirement as to show anything that isn't true - so "not in" {true} would fit that?
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
>