How to show modal when variable is empty

Hi, I have a Modal that I’d like to show when a variable is empty.

I also need it to open when triggered manually so I have a variable set for that.

The behaviour I’m seeing is that in my app, if I log in, then exit and come back later, I’m still authenticated but the data needs to be fetched again. The app won’t know what data needs to be fetched unless the user selects it, because they can have multiple versions of the data in their account. This happens in a modal.

So I need the modal to show when that data is blank, and also when the data is there but the modal is manually triggered to open (this would happen when the user wants to switch their data to another version)

This is what I’m currently doing but without success.Any help would be greatly appreciated.

Screenshot 2023-09-18 at 2.06.30 PM

Without checking in editor, I think this should work.
Its possible the currentLinchpin variable’s default value is an empty object/value such as {} so it might not recognize it as ‘false’. If you set it to completely empty, then it might behave as you expect.

If not, then maybe doings keys(currentLinchpin).length might help, but its a bit of a hack :smiley:

If the variable is undefined then you can do !variable
What type is it? Object? Text?

Thanks I’ll give that a try, the variable is an Object.

Either change it to a boolean, or aim for it’s property. In JavaScript an object is never false, even if empty.
So either do

[modalObject].open, dont forget to set it back then!
Or change it to a bool.

Curious for advice here.

A variable is set as an object. When that object is empty, I want to set the condition not to display the element. My attempt was something like this but as it was mentioned in the thread, there may be an issue since it’s looking for a true or false.

Screenshot 2024-05-22 at 11.05.07 PM

Took me a bit to figure out the formulas but it works!

I have two elements; one should display when variable object is empty, the other should display when the variable object is not empty. The way I got it to work is with a double-negative. Each of these is set on a different element but checks the same variable.

Screenshot 2024-05-23 at 12.21.59 AM

Screenshot 2024-05-23 at 12.19.33 AM