Jump to content
Server Maintenance This Week. ×

Hide Object When not working with global variable


This topic is 656 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Greets, all:

I'm not sure if this is a calculation issue or a script one, so I apologize if I'm posting in the wrong place.

Objective: Have a text box (or button) appear when a global variable is set to 1. (The text box has the word SENT in it to confirm to the user that an e-mail has been sent via a mail script.) I There's a two-second delay for the object to appear, then it'll be cleared by said script. The problem is, *blush*, I can't get it to work.

The script part is fairly straightforward:

 

Set Variable [ $$_SentMessage; Value: 1 ]

Pause/Resume Script [Duration (seconds): 2 ]

Set Variable [ $$_SentMessage; Value: 0 ]

 

The calculation within the Hide Object When field (under Behavior in the Inspector) is: Case ($$_SentMessage = 0 ; 1 ; 0 )

So, it's simple enough: When the global variable $$_SentMessage is equal to 0, it meets the True part of the Case statement so the object should be hidden. Conversely, if $$_SentMessage is set to 1, it results in a False so the object shouldn't be hidden.

I've tried many permutations of the calc, including adding quotation marks around the literals, but to no avail. Am I doing this wrong, or does  Hide Object When not work using global variables?

 

As always, thanks in advance for your replies/help.

Edited by WF7A
Typo
Link to comment
Share on other sites

Give your text box an object name, say message, and set it to hide when: 

not $showMessage

Then make your script:

Set Variable [ $showMessage; Value:1 ]
Refresh Object [ Object Name: "message"; Repetition: 1 ] 
Pause/Resume Script [ Duration (seconds): 2 ]
Set Variable [ $showMessage; Value:"" ]
Refresh Object [ Object Name: "message"; Repetition: 1 ]

You don't need a global variable for this - and you certainly don't want to set a global variable to 0 at the end of a script. To erase a variable, you must set it to "" (an empty string), otherwise it will hang on until the end of the session.

--
BTW, Filemaker offers a Show Custom Dialog script step for the purpose of messaging the user. In recent versions you can also use a card window. 

Edited by comment
Link to comment
Share on other sites

Thank you (again)! Works like a charm.

I previously named the object as you suggested, but with my coding it probably didn't make any difference. : P

Good idea about using a card window, but I already have the e-mail form as a card. To that end, I wanted to use a "flashing" object, instead of Show Custom Dialog, as an e-mail confirmation since it would be one less thing for a user to click (to be dismissed.)

Cheers!

Edited by WF7A
Link to comment
Share on other sites

Thanks! It's a reminder to me as well to start boning up on APIs and learning JSON....as well as learning new terms, e.g., snackbar.

 

More coffee. : )

Edited by WF7A
Link to comment
Share on other sites

This topic is 656 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.