Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Hide Object When not working with global variable

Featured Replies

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

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

  • Author

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

You might want to consider using a snackbar. 

 

  • Author

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

Web ui elements are creeping into our space. Users expect similar UX.  

Create an account or sign in to comment

Important Information

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

Account

Navigation

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.