Set default for boolean

Hello, I would like to set a default for user specific boolean column. It seems that booleans in Glide are tri-state (blank, true, false). I cannot find a true boolean variable in Glide (true/false or on/off). Is there a way to specify the default value being false rather than blank (in the data editor – not the screen, because I want it to apply to all rows for that user).

1 Like

What others have done is always test on True. Is true or is not true. This way you don’t need to worry if it is blank or false.

1 Like

Thank you. In reality, I would also like to be able to set the default value to true in some cases. I am doing as you suggested and only checking for true.

The reason I would like to also check for false is because I have an action that depends on if false or blank, set to true, and if true set for blank, but there are other checks on other fields to determine if a third boolean column is actually set, and it’s been hard to get the action to work correctly without having to click twice. I got it working by rearranging the tests on the third column (which is an if-else with about 6 tests in it), but it would have been much simpler with only a true/false to worry about in the first boolean column.

Do you have a screenshot of your actions? Are you actually checking for (blank OR false) as opposed to checking for (not true)? Just trying to get a visual of the problem. Setting a default is a different matter, but I’m not sure how that relates to you actions.

1 Like

There are multiple actions and fields involved. First of all, if a user enters a new entry, no one else can see it in their main list unless the “global” field is set to true. In the main list, their only option is to select whether the entry is going to be visible in other places in the app (dropdowns, etc.). So I have a “pickable” field that determines whether it is in the main list and a “show in list” field which determines whether it will show up elsewhere.

This is with one user:

This is with another user:

Here is “pickable”

Here is “show in list”

It works as-is.

I would like to have a user-specific field to make it pickable (global), but default to FALSE for “show in list”. Right now that’s not possible because a blank is determined to be false, and I don’t want them to ALL be false.

I had it working somewhat yesterday, but then realized it needed to be user-specific so I took out the field I had added (“default to false”)…

OK, I still need to read through this a few times and absorb it, but one red flag that I see is that in your ‘Show In List’ column, you are explicitly checking for false. Are you sure you want to do that as it will ignore if ‘Is Favorite’ is blank. Are you sure that you don’t want to to include blank by check for ‘is not true’ instead of checking for ‘false’? I just want to make sure that is your intention. Maybe that’s what you are getting at with setting a default.

I’m also a little confused on if Pickable is supposed to play a part in your Show In List column, since you are using Is Favorite, but not Pickable anywhere in the IF logic.

Is the main issue with your ‘Show In List’ IF column? I may be way off, but I would maybe structure it like this.
IF Global is true, then true
ELSEIF Favorite is True, then True
ELSEIF Owner is Owner, then True
ELSE false

Yes, I am ignoring blank because I want them to see it in the list unless they explicitly set it to false. And the way I have it in the show in list column works the way I have it. If I have it any other way, when they are on the screen to pick which ones show in the list, they have to click twice to toggle the flag (the first time it’s toggled).

As I said, the way it’s presented here works. I just want to expand the logic to explicitly set some of them to “view in list” as false before the user selects that setting. SOME – NOT ALL.

Is true :wink: I’ve never used these plugins before but I’ve always been curious when I might. I hope it helps you find what your looking for.

4 Likes

Hi, I looked at those, but never tried to implement them. I, too, hope that I will find a use for them one day. The following graphic illustrates the value they give when operated on the “is fav” user-specific column.

The column I added yesterday and then removed, I put back in just for illustration purposes here.

I really need a “default to false” that acts in a user-specific way.

There may be hundreds of items in the list (pre-populated, but the user may add their own).

Later in the program, the user can choose from their favorites. Probably only want a manageable list elsewhere of a few dozen items. But I want them to be able to pick their favorites from the hundreds available (on one screen). That’s the screen I’m needing this default to false user-specific. I want it to show on the screen, so they can explicitly set it to true or false. If they have not visited the screen, I want the items that I have selected to be either true or false – a default list for them.

“default to false” here is included in the image for illustration purposes only. I had it working, but removed it after I realized it had to be user-specific as well as “is favorite”. I cannot set these defaults myself on a user level because there are so many users, so I’d need some way to indicate that for any user, the column “is favorite” should default to false if it has never been set.

I cannot use “blank” as that default, because then every record would literally be default to false. So perhaps “default to true” would be a better way of putting it. I want a few dozen of the hundreds to “default to true”

Perhaps I’m missing something, but could you not just:

  • Create an if-then-else column
    – If Is Favourite is empty, then false
    – Else Is Favourite
  • And then use that column in place of the Is Favourite column when checking the status
3 Likes

No, I am the one that was missing something: that the “else” does not have to be true or false, but can be a column.

image

I will give that a try.

Everything started clicking when I changed my mindset from “default to false” to “default to true”. It just has to be far enough down this list and then it doesn’t have to be user-specific.

I also simplified this column by using the computed “pickable” column, which takes into account the “global” flag and the @owner.

I’m a happy camper. Thank you to all who helped me sort this very complicated issue out.

I appreciate all the helpful suggestions.

1 Like

If you point the plug-in to a user specific column then the plug-in becomes user specific as well. It sounds like you’re looking for ‘Not’

1 Like

Yes, I tried that, but again, that empty. I simply needed a default list that was applicable to all users but that they could override. I finally figured out a way to make that happen.

1 Like

This one worked for me. Thanks