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.

Inculing a script as part of a calculation field

Featured Replies

Hi,

Is it posible to include a "perform script" option as part of a calculation field?

Thanks in advance

Hi alopas! Welcome to the Forum! smile.gif

Well, you can use a global field which your script sets (depending upon other criteria or calculations), and then that global can be used within a calculation to produce the results you wish. Without more information, I'm afraid we couldn't answer your question appropriately.

Describe what you're trying to do and why. And give us the field names (and their data types) and we'll try to help you with it. But no, you can't 'run' a script from a calculation but there are probably other ways to accomplish what you wish. smirk.gif

LaRetta

  • Author

Hi LaRetta,

Thank you wink.gif. OK ... the thing is that I made a script that is activated after clicking on a field (the script shows a message, and the outcome depends on the option selected).

As you need to click on the field to activate the script, I thought that it would be easier if after pressing "tab", the script was activated

(I'm getting lazy blush.gif ... I was hoping that I wouldn't need to write the sequence again as a calculation field)

Alopas said...I was hoping that I wouldn't need to write the sequence again as a calculation field)

I'm unsure why you need the calculation. Depending upon what the User selects in your script Show Message dialog, what happens then? Does it set another field? And then does a calculation need to display, showing the results of this field (in conjunction with other calculation criteria)?

Why would you need to write the sequence again in a calculation field, can you explain more? The reason for using a calculation is so that it will update whenever values in a field change. Executing a script upon field exit is possible, although tricky (without a plugin). I'm unclear on what your calculation would produce or what your script does. Can you say a bit more about it? smile.gif

LaRetta

  • Author

OK, I'll be a little bit more specific: I have two FMP files ("A" and "B") with some common fields. I have a field called "X" in database "A" with two possible inputs: "Yes" and "No". What I would like to do is the following:

- If the input in field "X" (of database "A") is "Yes", then copy the info to database "B" in a new record

- If the input in field "X" (of database "A") is "No", then just go to the next record

I did it with a script, but in order to activate it I need to press a button. I was wondering the script can be activated just after selecting either "Yes" or "No" in field "X", without needing to press the button.

Thanks a lot! cool.gif

Yes, if you make the activation of "X" part of a script. Make two invisible buttons, one covering each radio button (assuming that is what you're using) option. Have one script set the field to 'Yes' and create a new record in "B". Have the other script set the field to 'No' and continue to the next record.

  • Author

Yes, that works for me. Thanks! smile.gif

Create an account or sign in to comment

Important Information

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

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.