Jump to content

Export Field Contents - Variable


This topic is 2298 days old. Please don't post here. Open a new topic instead.

Recommended Posts

I have a button on a portal that calls a script "Show_Container": 

Line 1:   Set Variable [ $Param ; Value: Get ( ScriptParameter ) ]        (name of container field is passed thru script parameter)

Line 2:   Set Variable [ $Path ; Value: Get ( TemporaryPath ) & GetContainerAttribute ( $Param ; "Filename" ) ]

Line 3:   Export Field Contents [ Table::Field ; ""$Path"" ; Automatically open ]

 

Wanting to reuse this script in multiple places, I need to be able to replace the "Table::Field" in line three with a variable, but can't see how to accomplish this.

Any ideas?

Thanks,

John

 

 

Edited by Woodeye
Link to comment
Share on other sites

I could easily rewrite the script for each layout/table it would be used in (the script is only 3 lines). What I am trying to do is get better at writing reusable scripts. In this case, I don't see how I can do this.

 

Link to comment
Share on other sites

You're not answering my question: the fact that you want this script to be reusable indicates a structural issue. It will be easier to solve the structural issue than to make this script reusable - not to mention that the structural issue will remain to cause you many other problems.

The target field of Export Field Contents[] cannot be parametrized. The only way to make this work the way you describe is to make sure that the required field is the currently active field - then use Export Field Contents[] without specifying the target field. You can make the required field active by looping among all fields in the layout's tab order until the active field's name is equal to the script parameter. Or give the field an object name and use Go to Object[] to make it active. Both are hacks designed to work around the real problem. And, IMHO, so is the solution linked to by @webko.

Link to comment
Share on other sites

I'm not sure it has to be a structural issue - I can think of a number of scenarios where I have container fields in different tables that I would like to Export - having one script to perform that function, rather then one for each Container field seems logical to me...

Link to comment
Share on other sites

I am obviously not only a failure at FileMaker, as I should have thought of using a global field. I am now conflicted as to whether to sign up for training in FileMaker or have someone teach me to use a Google search properly. 

Thank you for the help.

Link to comment
Share on other sites

This topic is 2298 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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.