animation_master Posted August 23, 2005 Posted August 23, 2005 This is a problem with passing a parameter to a script to tell it which layout to use. I have created a script that opens a Layout and Sets a field in that layout. Simple. Now imagine a Layout with a half-dozen buttons. Each button runs this same script, but the Layout it goes to is different for each button. I could make 6 copies of the script, modifying each one to change the name of its destination layout. But I’d prefer to write the script once, then have each button pass a parameter with the name of its destination layout. The Script step “Go to Layout” accepts a parameter to tell it which layout to go to. The Script step “Set Field” does not. So, using parameter passing, I can get to the proper layout, but, once I’m there, I can’t set a field on that layout. Any ideas?
Reed Posted August 23, 2005 Posted August 23, 2005 It sounds like you're trying to pass multiple parameters in one script. To do this you need to create a delimited list of parameters and pull them out using text manipulation etc. One easy way to do this is to pass a list of parameters as a return-delimited list, and use the MiddleValues() function together with Get(ScriptParameter) to pull out the right parameter when you need it.
Matthew F Posted August 23, 2005 Posted August 23, 2005 The Script step “Go to Layout” accepts a parameter to tell it which layout to go to. The Script step “Set Field” does not. So, using parameter passing, I can get to the proper layout, but, once I’m there, I can’t set a field on that layout. If I understand you correctly you want to pass parameters to your script that indicate not only what layout to navigate to but also the name of a field to set. A problem with the "Set Field" script step is that it does not allow the target field to be specified through a calculation. This is the subject of an old post and it includes a couple of hacks. See the link for more details: Wants and Wishes
Søren Dyhr Posted August 23, 2005 Posted August 23, 2005 A problem with the "Set Field" script step is that it does not allow the target field to be specified through a calculation. Well it's not too complicated to make: If [ PatternCount ( FieldNames ( Get ( FileName ) ; Get ( LayoutName ) ) ; LeftValues(Get ( ScriptParameter );1) ) ] Go to Field [ ] [ Select/perform ] Go to Next Field Loop Exit Loop If [ Get ( ActiveFieldName ) & "¶" = LeftValues(Get ( ScriptParameter );1) ] Go to Next Field End Loop Set Field [ Substitute ( Trim ( Substitute ( RightValues ( Get ( ScriptParameter ) ; 1 ) ; "¶" ; " " ) ) ; " " ; "¶" ) ] Commit Records/Requests [ Skip data entry validation; No dialog ] End If First value in the paramter is the fieldname you wish to send a value to and the second is the value in itself. Only thing missing is to put the scriptparamters to each button, the script is the one and same. --sd
Recommended Posts
This topic is 7034 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