• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint

Q&A

Q1:What are good uses for script parameters?
A1: Script parameters work particularly well when you have a number of similar scripts. The example in this hour showed a script that sometimes wants an interactive warning and sometimes doesn't. Another example is a script that creates a new record in all cases and sometimes enters data into it. You could use a script parameter with values “New Only” and “Enter Data” to handle that case. In the “New Only” section, only part of the script would execute; in the “Enter Data,” the “New Only” section would execute and an additional part of the script (or a separate script) would then execute.
Q2:Parameters are new in FileMaker 7. How did people write FileMaker scripts without them?
A2: To pass parameters into scripts before FileMaker 7, many people declared global variables into which they would store the “parameter”; the global variable could then be accessed from within a script. There is now no need to do this. However, if you're looking at a script written for FileMaker 6 or earlier, you may very well see this type of architecture. If you're sure that the global variable is only used as a parameter, you can replace it with a true parameter and remove it from the database definition (but be sure to save a copy of the database first in case it has other uses that you haven't encountered).

This situation is similar to that of relationships before FileMaker 7. Related fields were visible only across the relationship that spanned two databases. To access a field two databases away, you had to create a calculation in the intermediate table, which consisted simply of the field in the third database. By accessing the calculation, you could get to the distant related field. Such calculations are abundant in pre-FileMaker 7 solutions and can be removed as part of the conversion process. Ultimately, it makes for simpler databases, but the process of removing these calculations may unleash changes to scripts, layouts, and other calculations that cause more work in the short term.


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint