Skip 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.

Simple Script Trigger Script

Featured Replies

I have been away from FMP for quite awhile, and have forgotten a LOT.
I need a script (using a script trigger) that upon field entry will enter an 1 if the field is empty, or a blank if the field is valid.
Thanks in advance

Can you explain the purpose of this? Why is it necessary to trigger this upon entering the field? Will the user be entering more data after the script has run?

And what do you mean by "the field is valid"? The opposite of "empty" is "not empty", not "valid".

 

  • Author

I have multiple fields that need to be either empty or have a "Yes" entered. When the field is empty the script should enter the "Yes"...if the filed has "Yes" entered (isvalid) it should delete the field contents.

Well, the term "is valid" is taken for another purpose, so you should avoid using it here. I still don't see why you need a script trigger for this, instead of making the field a button. Then the script can do simply:

Set Field [ YourTable::YourField ; Choose ( YourTable::YourField ; 1 )

This will toggle the status between 1 and empty. I assume the field is defined as a Number field, and formatted as Boolean.

 

  • Author

Of couse! As I said I have forgotten a lot, even basic stuff like this.

 

Thanks so much

  • Author

Just getting back to this and I am having difficulty. To clarify, I need a script that will place an Asterisk "*" in a field (if the filed is empty), or will change the field to empty (if is an Asterisk). II tried your suggestion, but just can't seem to get it to work.

 

Thanks again for your interest.

2 minutes ago, John Chamberlain said:

I need a script that will place an Asterisk "*" in a field (if the filed is empty), or will change the field to empty (if is an Asterisk)

In your original question you talked about entering 1 if the field is empty - which IMHO is a much better arrangement than using an asterisk.

If you insist on asterisk, then you will have to do:

Set Field [ YourTable::YourField ; If ( IsEmpty ( YourTable::YourField ) ; "*" ) ]

 

Create an account or sign in to comment

Important Information

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

Account

Navigation

Search

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.