nick_jp Posted August 29, 2007 Posted August 29, 2007 Hi, Have been trying to do this for a couple of days but no luck so far. I have a field in my database, when I click it a window will popup and user will do stuff and eventually select a value. When the user exits the popup - that value should be written to the field the user originally clicked. I want to use this on several fields, by passing in the clicked field's name, and having the script update the calling field. I am trying to do this using the Get(ActiveFieldName) function. Here is a test I have tried - have the text field act as a button that calls a script, passing in Get(ActiveFieldName). Script's contents are: SetVariable[$i; Value:Get(ScriptParameter)] SetField[test::txtfld; $i] But no good. Am I using the function incorrectly? Thanks,
Vaughan Posted August 29, 2007 Posted August 29, 2007 I assume that the field object on the layout is formatted as a button to run the script... then why not put the name of the field into the script parameter on the button?
nick_jp Posted August 29, 2007 Author Posted August 29, 2007 Thanks very much - that works. Next question: is there a dynamic way to set the target for a "Set Field" script step? I want to be able to update the field that was passed into the script as an arguement.
Søren Dyhr Posted August 29, 2007 Posted August 29, 2007 Try this: http://fmforums.com/forum/showtopic.php?tid/179836/post/219571/#219571 --sd
Vaughan Posted August 29, 2007 Posted August 29, 2007 Since there is a limited number of fields, and you know in advaance which fields are involved (since you've done their buttons) it isn't hard manually programming the Set Fields steps condiaionally based on the script parameter.
nick_jp Posted August 30, 2007 Author Posted August 30, 2007 Thanks for the link Soren, it looks like what I'm after but I can't get the Go To Object step to work if the target is script input. Please see attached - there are a couple of buttons where I'm trying different things such as Go To Object, Go To Field etc. Vaughn, that's a very good idea, but this item will be used all over the solution, so would like to avoid hardcoding a list of target fields into an if statement if possible. dynamic_edit.zip
JesseSFR Posted August 30, 2007 Posted August 30, 2007 Your file was locked so it was difficult to look around. I debugged your script and noticed that you were you were attempting to use to compare the name of your field with get(activefieldname). That cf actually only returns the field name portion of the field not the fully qualified field name So instead of Table::Name it just returns name. I attached a file that should help you. I don't really recommend using it though because it only works if the field is on the layout. Also, if you have two fields with the same name you will end up in the topmost on the layout. Not necessarily ideal but hey... have fun with it. login: Admin no password You shouldn't need that but if you do : GoToField.zip
Recommended Posts
This topic is 6296 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