dmontano Posted Thursday at 08:23 PM Posted Thursday at 08:23 PM Hi all, I can not figure out how to pass a parameter to a subscript to be used in the filename when exporting records to excel if a user selection in a custom dialog window changes the found count of records. The problem is not specific to the export to "Excel", but rather my inability to get the updated "found count" into the exported filename. So, in this aspect, I consider this a variable that needs to update before it is processed by the variable calculation that "makes" the filename. I know my problem lies in the "second" level of branching that can occur if User selects an Export button when (found count = 0) which I think would be rare, but possible. I also understand that I could get around this challenge by getting rid of the third button "Export All" found in the Custom Dialog I present to User: I consider this the "second" level of branching. Since I am choosing to NOT circumvent the challenge this poses to me, and in spite of the fact that what I am trying to do might be "convoluted", I am planting a flag in the ground in order to learn how to pass parameters to subscripts, or to update a variable as a script runs based on User input or selection via custom dialog. I have practiced "avoidance" of FileMaker aspects long enough and trying to become more "learned", lol. So, if anyone is brave enough to sludge through what I am presenting (screenshots and stripped down FileMaker file) in order to see where I have failed and can provide insight - I appreciate it. I have done my best to communicate clearly, but know this is an art form I am not gifted with. Thanks in advance. script_problem.fmp12
comment Posted Friday at 04:44 AM Posted Friday at 04:44 AM (edited) This is a little too much to take in all at once. Consider simplifying the issue and/or breaking it up to individual points. Speaking in general, the script parameter remains constant throughout the life of the script, while a script variable can be defined and redefined at any point. If you want to export a file using a variable as the file's name, and the file's name is supposed to contain the count of exported records, then of course you will want to define that variable as close to the export as possible and not before any event that can modify the current found set. HTH. Edited Friday at 04:52 AM by comment 1
dmontano Posted yesterday at 05:18 AM Author Posted yesterday at 05:18 AM On 7/24/2025 at 9:44 PM, comment said: This is a little too much to take in all at once. Consider simplifying the issue and/or breaking it up to individual points. Hi Comment - thanks. Sorry about the overload: I tried to simplify, lol. I know for sure that I have over-complicated this while trying to simplify it: definition of oxymoron? I will dive back into this and see if I can break this down into digestible pieces. On 7/24/2025 at 9:44 PM, comment said: while a script variable can be defined and redefined at any point Ok, this is good to know. This means that I can define a "first instance" variable for the "found count" to begin with, and redefined this variable differently based on another selection a User makes during the scripts execution, for example, the custom dialog I am presenting to User allows them to make a "second" selection. On 7/24/2025 at 9:44 PM, comment said: the script parameter remains constant throughout the life of the script Is it safe for me to assume that a script parameter passed into a script (from a button, for example) does NOT get passed into a subscript unless we specifically configure the script to pass to subscript? And a subscript would need to be configure to "receive" the parameter from its parent script? I hope to put some effort into this tonight - thanks again.
comment Posted yesterday at 05:41 AM Posted yesterday at 05:41 AM 10 minutes ago, dmontano said: Is it safe for me to assume that a script parameter passed into a script (from a button, for example) does NOT get passed into a subscript unless we specifically configure the script to pass to subscript? Yes. Every script has its own parameter that must be passed to it explicitly when the script is called. To pass its own parameter to a subscript, the calling script would need to do: Perform Script [ “abc”; Parameter: Get ( ScriptParameter ) ] Keep in mind that a subscript does not "know" it's a subscript. It runs independently and does not inherit anything from the calling script. 1
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