Dimwhit Posted January 24, 2007 Posted January 24, 2007 (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!
mr_vodka Posted January 24, 2007 Posted January 24, 2007 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 []
Mikhail Edoshin Posted January 24, 2007 Posted January 24, 2007 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.
Dimwhit Posted January 24, 2007 Author Posted January 24, 2007 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?
mr_vodka Posted January 24, 2007 Posted January 24, 2007 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.
comment Posted January 25, 2007 Posted January 25, 2007 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
mr_vodka Posted January 25, 2007 Posted January 25, 2007 Very nice Michael. I didnt realize that the local variable values could be passed that way. Very informative. Thanks for that.
Søren Dyhr Posted January 25, 2007 Posted January 25, 2007 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: , 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
mr_vodka Posted January 25, 2007 Posted January 25, 2007 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.
Dimwhit Posted January 25, 2007 Author Posted January 25, 2007 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.
Søren Dyhr Posted January 25, 2007 Posted January 25, 2007 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
Mikhail Edoshin Posted January 25, 2007 Posted January 25, 2007 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 ???
Raybaudi Posted January 27, 2007 Posted January 27, 2007 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.
Recommended Posts
This topic is 6512 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 accountSign in
Already have an account? Sign in here.
Sign In Now