January 20, 200323 yr I need to perform an external script and I need to pass it some parameters (arguments). What I do is: 1. write the parameter in a global field TEMP_A 2. copy to the clipboard the global field's content 3. performing the external scipt. The external script pastes the parameter in a global field TEMP_B then access the data and performs. It works, but it seem to me a very inelegant procedure (a hack). It comes difficult to pass several parameters and the user loses the content of the clipboard. Another solution is to use a specific file for storing parameters. Access to parameters is achieved trought relationships. This work but it is a very complicated way do to something very simple..
January 20, 200323 yr Just forget about the copy/paste part, and use a relationship to get them. They're in global fields so it doesn't matter which records relate, or even if any records relate at all. For example, if I have a clients database and an invoices database, and I want to invoice a client: Clients Set field, globalClientNumber, clientNumber Perform script, External, new invoice from clients Invoices Script: New Invoice from clients New record Set field, clientNumber, Clients::globalClientNumber Invoices must have a relationship to cients, but it need not have related records from the current record, so you might as well use the clientNumber field since you may use this relationship for other things like "show client file" from the invoice. Of course it doesn't matter which file you have the globals in, I could just as well have used a global field in invoices.
January 20, 200323 yr Author First of all, thank you for your reply. But suppose the solution is multi-user. What happen if two users invoice a client simultaneously ? Or (more general) what happens if two scripts that uses the same global in a related file are performed at the same time ? Scripts are performed on the user machine so one script may start before another (from another user, who access the same global) has finished. May they interfere each other ? Again, thank you. Paolo.
January 20, 200323 yr Global fields' values are actually local to each user, so they can't interfere with each other. Filemaker's use of the term 'Global' is very misleading.
January 20, 200323 yr Well..... Yes & No. Global is local to each user but Global to every record (in that database). I know. A technicality.
January 28, 200323 yr I've written a plugin for exactly this purpose. Any number of parameters may be passed and returned, within scripts of the same file or across files. It's Mac & Windows compatible. There is a small syntax learning curve, but well worth the effort. It is documented, with examples, and a sample file for downloading. The plugin enabled me to do things not possible with relationships to globals, which can get quite messy and unmaintainable for anything but the simplest examples. I wrote and deployed it for use in a commercial product, so it's solid and reliable, with thousands of commercial customers unaware of its use. It is now available as shareware. Check out 'Jazz Params' at www.jazzmedia.com.au
Create an account or sign in to comment