dmontano Posted July 14 Posted July 14 Hi all, I have a script that I would like to use in multiple "similar" situations. To do this, I need to pass a parameter to set a variable for it to FIND a record in the PERFORM FIND script step - specifically in the EDIT FIND REQUEST dialog (see screenshot attached). Any help is appreciated, thanks.
comment Posted July 14 Posted July 14 (edited) You cannot use a variable to specify the field in the Edit Find Request window. But a find request can also be constructed through setting fields - and then you can use the script parameter to select which field to use, similar to what we discussed only recently here: https://fmforums.com/topic/110860-script-problem-remove-container-file-from-a-record-trying-to-transition-to-json-to-pass-multiple-parameters/#findComment-494081 Edited July 14 by comment 1
bcooney Posted July 14 Posted July 14 Just to comment on this line of thinking: “I have a script that I would like to use in multiple "similar" situations”. Be aware that what seems economical can lead to highly conditional scripts that are difficult to maintain or change without risk. Separate scripts without much indirection or abstraction are more easy to maintain and troubleshoot. Consider the trade off you’re making. 1
dmontano Posted July 23 Author Posted July 23 (edited) On 7/13/2025 at 9:38 PM, comment said: But a find request can also be constructed through setting fields - and then you can use the script parameter to select which field to use, similar to what we discussed only recently here: https://fmforums.com/topic/110860-script-problem-remove-container-file-from-a-record-trying-to-transition-to-json-to-pass-multiple-parameters/#findComment-494081 Hi Comment, I appreciate your help once again! Apologies for my absence in replying (I got pneumonia and finally getting back to things). It took me a while to figure out what you, ultimately, clearly explained! I did get this to work. The trick for me was to use the "Enter Find Mode" script step instead of just the "Perform Find" to get my variables to be utilized. I believe I implemented this correctly...? Using "GetFieldName" function in a similar way as you prescribed in the link you referenced helped me understand the need to - at times - get either one of these two parameters. I certainly suffer from "can't see the forest for the trees" and trying to improve. I have attached two screenshots: The parameters I passed to script Script steps I used Thank you! On 7/14/2025 at 4:44 AM, bcooney said: Be aware that what seems economical can lead to highly conditional scripts that are difficult to maintain or change without risk. Separate scripts without much indirection or abstraction are more easy to maintain and troubleshoot. Consider the trade off you’re making. Hi Barbara, I appreciate your insight: I am starting to see these "trade-offs" you speak of. I have learned how to use sub-scripts to help in this area, and I'm learning branching. It's an interesting "dichotomy" if you will: making scripts handle multiple situations (branching) is somewhat akin to "rolling-things-up; and sub-scripts are like boiling things down into discreet elements. I have actually spent probably 6 weeks on the scripts for my "function bar" and find myself going back and forth. There certainly is both art and science to this - and my minimal experience in scripting certainly makes it more challenging! Edited July 23 by dmontano legibility
Recommended Posts
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