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.

Is this possible to do with a script?

Featured Replies

(Hope this is in the right place...)

I want a way to enter a number in field1, then have that number automatically added to field2, then have the field1 reset to have no value.

I'm learning my way around FM, but I'm still pretty green when it comes to scripts. Thanks!

If the fields are from the same table or related tables then:

Set Field [ field2; field2 +field1 ]

Set Field [ field1; "" ]

Commit Record []

Otherwise, you have to set a variable or global field with the value of field1, go to a layout from the second table and then, Set Field [ field2; $variable + field2 ] or Set Field [ field2; globalfield + field2 ]

Commit Record []

Add an auto-enter formula to field 1:

Let( $$new value = field 1, "" )

and to field 2

Case( field 1 or True, field 2 + $$new value ).

Both auto-enters must overwrite the existing value.

I haven't tested this, so be careful.

  • Author

If the fields are from the same table or related tables then:

Set Field [ field2; field2 +field1 ]

Set Field [ field1; "" ]

Commit Record []

Otherwise, you have to set a variable or global field with the value of field1, go to a layout from the second table and then, Set Field [ field2; $variable + field2 ] or Set Field [ field2; globalfield + field2 ]

Commit Record []

Perfect! Simply, and exactly what I needed.

So I guess I'll ask the last question: Is there a way to set the scrip to run as soon as I've entered a value into Field 2, instead of me running the script manually?

To run a script upon exiting a field, you can use a plugin like EventScript.

Also you can take a look at Mikhail's post. These are number fields with calculted values, but I must warn you that you will not be able to clear out the second field without clearing out the global variable as well. Also, as he said, keep in mind that it hasnt been fully tested so its buggy.

I have modified Mikhail's suggestion slightly, and I believe that should work, including clearing the result.

Scripted or not, I don't think this is very useful without leaving a trail of entries.

AutoSum.fp7.zip

Very nice Michael. I didnt realize that the local variable values could be passed that way.

Very informative. Thanks for that.

Very nice Michael. I didnt realize that the local variable values could be passed that way.

Well I have, here:

http://www.kevinfrank.com/download/county-highlight-in-portal.zip

But indeed :thumbup: :thumbup: :thumbup: :thumbup: :thumbup:, it's one of those things that doesn't heureka for me, but rather a sneak in to my mind ...there are still some time left until I throw it after everything i sheer exicement.

--sd

Hey Søren,

But Mikhail and Kevin's techniques use global variables to accomplish this. I did not know you could do it with a Local one as well as Comment has shown.

  • Author

I have modified Mikhail's suggestion slightly, and I believe that should work, including clearing the result.

Scripted or not, I don't think this is very useful without leaving a trail of entries.

Wow, that's an even better solution. Thanks! This is perfect.

In this case, I don't need a trail of entries, though I can certainly think of many times when that would be wise.

But Mikhail and Kevin's techniques use global variables to accomplish this. I did not know you could do it with a Local one as well as Comment has shown.

Yeah - They're apparently kept until a script is fired? It kind of follow what could be seen in the "inspector"...

--sd

But Mikhail and Kevin's techniques use global variables to accomplish this. I did not know you could do it with a Local one as well as Comment has shown.

Me neither. Great to know this. Thanks, Comment ???

Simple and genial !

I have modified a little the calc of "Sum":

Let ( [

trigger = Entry ;

value = $entry ;

$entry = ""

] ;

Sum + [color:red]Evaluate( value )

)

so now I can enter a calc into the "Entry" field too.

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.