Inhaltsverzeichnis
What is a script in FileMaker?
With a Script any processes in a FileMaker database can be executed automatically. FileMaker supports the creation of any number of scripts per database, which in turn (theoretically) can contain any number of commands. With script parameters any parameters can be passed between scripts.
Add a new script until FileMaker 13
Scripts can be added and edited in FileMaker up to version 13 using the menu command [Scripts > Manage Scripts].
To add a new script in FileMaker up to version 13, click the [New] button in the Script Editor. By clicking the arrow icon, you can optionally add an empty script, a default script, a script folder, or a separator.
Script folders can be used to arrange scripts hierarchically in the script editor.
With a standard script, the following commands are automatically inserted into the new script:
Enable Browse Mode []
Go to Layout ["Current Layout" (Current Table)]
Show all records
Add a new script from FileMaker 14
Scripts can be added and edited in FileMaker 14 and later using the menu command [Scripts > script workspace].
To add a new script in FileMaker 14 and later, click the [+] button in the script workspace, and a new script is immediately created that you can name as you wish. A script folder and a separator line can now be created by clicking the corresponding icons in the [Scripts] bar below the [+] icon. Script folders can be used to arrange scripts hierarchically in the script editor.
Script parameters and global variables
For many years, FileMaker has supported adding script parameters to scripts to exchange data between scripts. With each script call a parameter can be added, which can be set within the script with the function
Get ( ScriptParameter )
can be read out again. In principle, data can also be written into a global variable to be read out by all scripts within the same file. Script parameters, on the other hand, can also be passed across files.
Pass multiple script parameters
Although a script parameter in FileMaker consists of only one line, several parameters can be transferred at the same time with appropriate separators. The apostrophe | can be used as a separator, which normally does not appear in other data.
Custom Function “StringTeilen”
With a small custom function the separation of a string can be simplified. You can integrate the following function into your FileMaker solution using FileMaker Pro Advanced to split a string with separators into its individual entries:
>strong>StringParts ( String; Number ) =
cases(number = 1;
characterLeft ( String; (Position ( String; "|"; 1; 1))-1);
center of character ( String; (Position ( String; "|"; 1; Number-1))+1; (Position ( String; "|"; 1; Number)) - ((Position ( String; "|"; 1; Number-1))+1))
)
example
$string = "House|Boot|Auto|"
StringParts ($string; 1) = "House"
StringParts ($string; 2) = "Boot"
StringParts ($string; 3) = "Auto"
Script-Trigger
FileMaker allows many different script triggers on different objects to execute scripts on specific user interactions or on a scheduled basis. For example, you can have scripts run automatically when a particular layout is called, when a special key is held down during a mouse click, when a field value is changed, and for an almost infinite number of other actions.