Here’s a complete list of all available script steps along with a description of each, available options or settings, and an example or code snippet.
Some of the sample code that follows may seem a bit silly and unrealistic, but you’ll find plenty of real-world code in the sample databases on the CD-ROM for the Computer Shop solution. Explore the scripts in those databases for further examples. Most of the Pause Script steps in those examples are there only to slow down the action so that you can better see and understand what’s happening.
Control Script Steps
Control script steps control the action within scripts themselves. They allow you to tell FileMaker Pro to do exactly what you want, when you want.
Runs a subscript from within the current script. The subscript can be called in the current database or in any other database. Several Perform Script steps in a row will be performed one after another, allowing you to modularize your scripts.
Also, because you can store only one set of criteria for certain script steps (including sort order, export order, import order, find criteria, and page/print setup) you can create subscripts to store different sets of criteria and call them conditionally, when necessary. For example, when in Windows you could run the Windows print setup subscript and then continue with current script; or, on a Mac, you could run the Mac page setup, and so on.
If you want to return to the current database after running an external subscript, put a “Go to Field ” (without specifying any field) step at the end of the parent script.
OPTIONS: The Specify menu lets you choose which script to run. For an external script, select External Script, then select the database and then the script to run. Check “Perform sub-scripts” if you want subscripts in the script you specify to run, too. Otherwise just the specified script will run, ignoring any subscripts specified in it.
EXAMPLE: This script goes to a certain layout, performs a subscript, and shows a message to the user.
Pauses the currently running script for the time specified. You might use this step to go to a splash screen for a few seconds and then continue loading a database or to bring the user to various layouts where data entry is required. (You can pause on each screen, waiting for user to enter stuff and then click Continue.)
This step is also useful when debugging scripts if you don’t use Developer’s script debugging tool. To do so, add pauses into your script to stop the action to see what’s going on if, for example, you’re getting lost in a loop or a field isn’t being set properly.
When a script is paused, only certain menu commands are available, allowing you more control of what a user can do while running a script. For example, when a script is paused you can’t access other databases in the Window menu (go to another database) or quit FileMaker Pro using a menu command. (You can define buttons attached to scripts or script steps to allow these activities, though; see FileMaker’s online help for more info on this feature.)
If the script allows user abort, a user could press ESC during the pause and exit the script and become stranded. Thus, it’s usually best to turn user abort off.
Click Specify and you’ll see the Pause/Resume Options dialog. Here, you can check “indefinitely” to require user action to continue the script. Or you select “For duration given by field value,” which will pause for the amount of time specified. Once the specified time is up, the script continues.
EXAMPLE: This script disallows user abort, goes to the pause layout, and then requires user action to resume the script and return to the original layout.
Causes the currently running external or subscript to stop running and return to the parent script.
EXAMPLE: This script runs a subscript that checks to see if it’s Thursday. If so, it prints the report.
Stops the currently running script from running whether it’s a parent script, a subscript, or an external script. When a script hits the Halt Script script step, everything stops and the user is left wherever the layout was last called, in the last mode invoked.
As you develop databases, you can create a script with just one step (this one) in it and use it to abort any running script that’s caught in an infinite loop. To do so, invoke your Halt Script script from the Scripts menu. (Make sure that the script is checked to appear in this menu and that it is one of the top ten scripts in ScriptMaker first, obviously.)
You can also use Halt Script in a script when you want everything to stop dead if a dangerous action is about to occur, like replacing data in records.
EXAMPLE: The user is taken to the first layout and asked if she wants to replace data in a field across all found records. If not, the script is halted. If so, a replace is performed.
If evaluates a yes/no or true/false calculation and then performs an action based on whether the calculation is true or not. For instance, the If statement can see if the status field equals “Complete” and, if so, print a specific report, or do nothing if not.
For every If statement, there is an End If, which ends the conditional part of the script. End If is entered automatically when you select the If script step. This also works with Else, which allows you to specify what you want to happen if the initial If statement proves false. (Else means, in essence, if this isn’t true don’t do this first action; do this other action.)
Ifs can be nested within each other, too, allowing you to create complex if/ then logic, if you like.
OPTIONS: The Specify button allows you to specify the calculation that determines whether the If is true or not. Any nonzero result is true; all others are false, stopping the subsequent script steps contained between If/End If.
EXAMPLE: If the field called Text has a value in it, then you are told that you are cool. If you select Yep, you’re given one message; if you pick Nope you’re given another message. If Text is empty, nothing happens.
Used only with If/End If. Else does the first action if true, the second set of script steps if false.
EXAMPLE: See the example for If, above.
Represents the end of the If/End If routine. Note the indentation of all your Ifs/ End Ifs. This helps to ensure that the other script steps between your If/End Ifs are in the right place; this is especially helpful when there are many nested If statements because it helps to keep things clear.
Although End If is listed as a script step that you can add, you’ll almost never do so because End If is always inserted when you add an If step. You would only manually add an End If step if you accidentally delete an existing one.
EXAMPLE: See the example for If, above.
Used to repeat a set of script steps as often as a user likes. Loop is used with End Loop, which signifies the end of the repetition.
The only way to get out of a loop in a script is to use the Exit Loop If script step or, if the “Exit after last” option is selected in a “Go to [Record/Request/ Page]” or “Go to Portal Row” script step that’s inside the loop.
You may have as many loops within loops as you like (useful for looping through a bunch of records and all of their child records), but try to subscript nested loops when possible for clarity.
EXAMPLE: This example goes to the first record in the database, enters the loop, and cycles through all records in the found set and sets the time field to the current time. When the last record is reached, the loop is exited. If there are more than 20 records in the found set when the script is started, the loop is exited right away (with the Exit Loop If script step) and the user is given a message. (This is just so you don’t have to wait through such a long, simple example script!)
Exit Loop If
Use this within a Loop/End Loop to get out of a loop if the specified calculation proves true. It’s used hand in hand with Loop/End Loop.
If the specified calculation is not true, the script continues repeating script steps in the loop when or if the calculation becomes true. You can get caught in an infinite loop if you aren’t careful (requiring you to force-quit FileMaker Pro if user abort has been turned off!) — if the calculation can never be true and there’s no other way coded in to get out of the loop. Be very careful.
OPTIONS: Click Specify to specify the calculation, much the same way you specify a calc for an If script step.
EXAMPLE: See the example for Loop wherein an Exit Loop If is used.
This signifies the end of a looping set of script steps and always corresponds to a Loop step higher up in the script. Although End Loop is listed as a script step that you can add, you’ll almost never do so manually because End Loop is always inserted when you add an Loop step. You would only manually add an End Loop step if you accidentally deleted an existing one.
EXAMPLE: See the example for Loop wherein an End Loop is used.
Allow User Abort
This allows you to specify whether a user will be able to abort out of a script manually by pressing ESC or by typing COMMAND-. (period) on a Mac.
Be careful. Don’t set user abort to off until you’ve thoroughly tested a script, in order to avoid getting into an endless loop of “force-quitting FileMaker Pro death.”
This is useful when you want to control where a user ends up when a script finishes (or during the middle of one if they abort early with user abort switched on).
OPTIONS: On prevents users from aborting the script. Off, the default, allows users to abort the running script.
EXAMPLE: See the example for Loop wherein an Allow User Abort is used.
Set Error Capture
This allows you to override built-in FileMaker error messages and to create your own, and to capture FileMaker’s internal error numbers for your use. If there is an error when a script starts, and error capture is on, the error is sent to the Status(CurrentError) function, which you can then display by capturing it into a field.
This is one of those script steps like “Allow User Abort [Off ]” that you’ll almost always want to add to the beginning of your scripts, probably by placing both steps in a separate subscript and calling that script from the rest of your scripts. When you anticipate that an error might occur (such as when searching scripts) you can check for errors like no records found, no criteria entered, and so on, and handle them with more grace than FileMaker would.
OPTIONS: On, the default, suppresses standard error dialog boxes. Off allows standard error dialog boxes.
EXAMPLE: In this example, error capture is first turned on. Then, the script goes into Find mode and finds something you’re sure isn’t in the database, as an example. An error is generated (no records found) but you suppress the built-in error dialog and show your own. Then error capture is turned off and the process repeats, showing you the standard error dialog for this error.
Here are all of FileMaker Pro’s error numbers, should you want to trap for very specific errors:
The following script steps deal with navigating through a database’s records, layouts, portal rows, and so forth.
Go to Layout
Goes to the layout of your choice in the current database.
OPTIONS: Refresh Window lets you specify whether you want the screen to refresh and show the selected layout right away (checked), or when the script has run its course (unchecked). Under Specify you can either select a layout to go to by name or use a layout number from field. The latter option will go to a layout based on a number in a field, the same value you would get for a layout using the Status(CurrentLayoutNumber) function. Selecting “original layout” under this menu brings you to the same layout that was on the screen when the script started.
EXAMPLE: This script goes to the Pause layout for two seconds and then returns the user to the original layout.
Go to Record/Request/Page
Goes to the specified record in the found set, find request, or page of a report, depending on whether you are in Browse, Find, or Preview mode, respectively.
OPTIONS: The Specify menu lets you choose:
First, which takes you to the first record, find request, or report page, depending on the mode.
Last, which takes you to the last record, find request, or report page, depending on the mode.
Previous, which takes you to the previous record, find request, or report page, depending on the mode. Checking the “Exit after last” checkbox will exit the loop (if the script is in one) after reaching the last record in the found set.
Next, which takes you to the last record, find request or report page, depending on the mode. Checking the “Exit after last” checkbox will exit the loop (if the script is in one) after reaching the last record in the found set.
By Number, which takes you to the record, find request, or report page (depending on the current mode) that you specify by number. The record number is the same number you would get with the Status(CurrentRecordNumber) function. You can further specify whether this number is hard-coded into the script or the user is prompted to enter or confirm the number with the “Perform without dialog” checkbox. When this is checked, the user is not asked to input a number.
By field value, which takes you to the record, find request, or report page (depending on the current mode) as specified in the referenced field. The record number is the same number you would get with the Status(CurrentRecordNumber) function.
EXAMPLE: This script goes to various records in the found set of records in Browse mode, pausing in between so you can see which record you’ve jumped to.
Go to Related Record
Takes the user to the related record of the specified related database or to the clicked related record if the script is started while the cursor is in a portal row.
This means that the related database is brought to the front and, unless you control what happens, the user is plopped into that related database on whatever layout happened to be up last.
OPTIONS: Specify lets you pick which relationship you’ll be using.
Define Relationships is available if the relationship does not exist yet. If you check the “Show only related record” box, when you get to the related database, all valid related records via that relationship will be isolated into a new found set. For instance, if you checked the box for the example code below, you would be taken to the clicked contact in the portal row, but the found set would be only related contacts of the clicked contact’s parent company record. Now a user can browse other contacts for the same company as well.
If you wanted just the clicked contact in the portal to be in a found set of one when you get to Contact.fp5, you could add the following code to the end of the external “Go to General Info” subscript that’s called:Show all records Omit Record Show Omitted
The above script step sequence comes in handy in many situations when you want to isolate just the current record.
EXAMPLE:In this example, if there are no related records to jump to (this script is attached to a button in a portal), the user just gets a beep. If there are related records, the user is taken to the related record she clicked on. Then an external script is run to control which layout is brought up once the user is taken to Contact.fp5.
Or, say you are on a contact record and you have a button to take you back to that contact’s company record. If you go to Contact.fp5 and click the underlined words, Bill Company, you will invoke such a script.
Go to Portal Row
Takes the user’s cursor to the specified portal row in the currently active (clicked into) portal. If no portal is clicked into, user is taken to the first portal in the layout’s stacking order.
OPTIONS: In the Specify menu you can choose:
First, which takes you to the first portal row.
Last, which takes you to the last portal row.
Previous, which takes you to the previous portal row. Checking the “Exit after last” checkbox will exit the loop (if the script is in one) once the last portal row is reached.
Next, which takes you to the next portal row. Checking the “Exit after last” checkbox will exit the loop (if the script is in one) after the last portal row is reached.
By Number, which takes you to the portal row that you specify by number. The portal row number is the same number you would get with the Status(currentportalrow) function. You can further specify whether this number is hard-coded into the script or the user is to be prompted to enter and confirm the number by using the “Perform without dialog” checkbox(When checked the user is not asked to input a number.)
By field value, which takes you to the portal row specified in the referenced field. The portal row number is the same number you would get with the Status(currentportalrow) function. When checked, the “Select entire contents” box means that the portal row will be highlighted when you jump to it. Otherwise, you’ll be left in the first enterable field with the cursor blinking.
EXAMPLE: This script goes to various portal rows of the current record in Browse mode, pausing in between so you can see which row you’ve jumped to.
Go to Field
This brings the cursor into the specified field on the current layout. (The field must be on the layout, of course.) The cursor is placed at the end of the field if the field already contains text.
Also, action can be taken on an object in a field. For example, a movie or audio snip can be played or an OLE object can be launched. The user does not have to have been given cursor access to the field in Browse or Find mode for this script step to work. This feature is useful in this case because it permits you to disallow casual clicking in a field, which allows you to script what happens when someone tries to enter a field.
You can also use this step at the end of scripts (with no field specified) to bring users back to a database after performing some external subscript.
The Specify checkbox and the Field button let you select which field will be moved to. The field can be a local one, a related one, or even a field in a portal.
Check “Select/perform” if, after the user is moved to the field, you want the contents highlighted (if the field contains text or a graphic) or choose “run/ performed” if it contains an audio clip or movie. If the field contains an OLE object, it will activate that object’s creator application and perform its default action (like “ready for editing” in a Microsoft Word document).
EXAMPLE: This script just jumps around to various fields, showing what it looks like to go to a field and sometimes have the contents selected/performed.
Selecting an empty container field brings up a dialog for you to record a sound to be contained in the field.
Go to Next Field
Goes to the next field on the current layout, based on tab order. If no field is selected, the cursor will go to the first field.
EXAMPLE: This script tabs forward through several fields.
Go to Previous Field
Goes to the previous field on the current layout, based on tab order. If no field is selected, the cursor will go to the last field.
EXAMPLE: This script tabs forward through several fields.
Enter Browse Mode
Switches user into Browse mode for editing and browsing data. This is useful at the beginning of a script in which you’ll be doing some copy/pasting of some data from one place to another.
OPTIONS: The Pause checkbox allows you to pause in Browse mode to allow the user to enter something and then have the script move on.
Enter Find Mode
Switches the user into Find mode for searching and finding data or for storing find criteria in a script. This is usually used hand in hand with Perform Find, which executes a find based on the entered (or saved) criteria.
The Pause checkbox allows you to pause in Find mode to allow the user to enter something, usually find criteria, and then have the script can move on, typically to perform the find.
The “Restore find requests” checkbox allows you to set up a saved set of find criteria that is “remembered” when this script step is invoked. Fo instance, you may want a user to be able to click a button that always finds invoices with a date earlier than today. To set this up, you would firs manually do a find yourself in the database, then go into your script and add the “Enter Find Mode” script step with the Restore option checked. Now whenever you run this script, these criteria will be remembered and auto-entered for the user in Find mode. (The user can always modify the Find criteria if you allow them to do so by pausing on an editable layout in Find mode.)
There’s no way to tell what the stored find requests/criteria are in ScriptMaker. However, these criteria will show up if you print the script. This goes for page/ print setup, import, export, and sort order information you would like to save in a script as well.
In order to change these find criteria later, manually do a Find again in the database, enter the script, and, without changing anything in the script steps, just click OK to leave the script again. The following dialog will come up:
Here, you push all the buttons for the new criteria you would like to overwrite with the criteria you just set up manually. If you just want to update the find criteria, check Replace in Find Requests. To keep everything as it was, leave the Keep box selected.
EXAMPLE: This script asks whether the user wants to restore a stored find criteria that was saved when the script was built, or start fresh. If the user restores the saved request, he is plopped into Find mode with the find request restored.
When he clicks continue, the find is performed and he is returned to Browse mode to see the found set. If the user starts with his own request, he is plopped into Find mode, where he must enter some find criteria. When he continues, either a found set or a custom error message is shown, stating the error. All records are restored to the found set.
Enter Preview Mode
This switches the current layout into Preview mode, a non-editable mode showing how the layout will look when printed. In Preview mode, page margin settings will be shown as well as headers, footers, page numbering, sub-summaries, and so on, all in the proper order.
OPTIONS: “Pause” allows the user to preview the printout on screen and flip through the record’s /report’s pages before, say, sending the document to the printer.
EXAMPLE:This example restores the page margins and print settings, goes into Preview mode on the current layout, then prints and returns to
Setting error capture here will suppress the dialog you would get when canceling out of the print dialog that comes up at the end of the script.
The following script steps concern sorting, finding, and printing records.
Sorts records in the current found set by the criteria specified by the user. Despite popular belief, there’s no need to enter Browse mode first (this happens automatically while sorting).
“Restore sort order” will run the sort that you’ve specified ahead of time and saved into the script when you created it. If you uncheck this box, FileMaker will simply use the last used sort order when sorting. “Perform without dialog” indicates whether the sort dialog will come up before the sort runs, which would allow a user to specify or alter the sort order.
EXAMPLE: This script just goes to the first layout and sorts the records in the found set (with a dialog, so the user can tweak the saved sort order).
Nullifies the current sort order, if any, and puts the records in the found set back into the order in which they were created.
EXAMPLE:Goes to a layout, sorts a stored sort order, enters Preview mode, then goes back to Browse mode and unsorts the records, putting them back into the order in which they were created.
Show All Records
Restores (or unspecifies) the found set such that every record in the current database is found/in the found set. This does not move you to a different record than the one you’re on.
This is useful when a find script finds no records because it allows you to start the user over with all records. It’s also useful when attached to a button, which allows a user to leave a found set and return to the “all” set, or in a script that cancels the user out of Find mode and sends her back to Browse mode.
EXAMPLE: See the end of the script example for Enter Find Mode.
This script step isolates a found set of all records that are not in the current found set. Thus, if the current found set is one record but the database has ten records in it, this script step would isolate a found set of the other nine records, omitting that original one.
EXAMPLE: Goes to all records in the database, omits the current record from the found set, then shows that one omitted record in a found set of one.
Temporarily removes or hides the current record only from the current found set of records, leaving you on the next record, if there is one. In Find mode, this step actually makes that find request an omit request, as in “Show me all records that don’t meet this find request’s criteria.”
EXAMPLE: See the preceding example for Show Omitted.
Removes/hides a group of records from the current found set, starting with the current record. Thus, if you have a found set of six and are on record one, omitting two records will leave the user on record one in a found set of four.
If you are in the last record of a found set, no records will be omitted. Furthermore, if you try to omit six records and there’s only one record in the found set after the one you’re on, no records will be omitted. (Error checking will prevent you from trying to omit more records than are in the database.)<.
OPTIONS: “Specify” allows you to indicate what the saved number of omitted records will be. The “Perform without dialog” prevents the user from changing the number of records to omit when checked.
EXAMPLE: This example goes into Browse mode and omits two records, starting with the currently viewed one.
This either performs a find based on a stored set of criteria (stored in the script step) or finds records based on user- or script-entered find criteria. (Create find requests and specify find criteria in the script with Set Field script steps and such.)
OPTIONS : The options follow:
Replace Found Set starts over with a new found set (forgetting any currently found set), using the criteria entered in the find request.
Constrain Found Set shrinks the existing found set using the criteria in the find request (“Show me all the ‘John’ records within all the ‘Johnson’ records”).
Extend Found Set expands the existing found set using the criteria in the find request (“I’ve found all the elephant records; now find all the antelope records”).
The “Restore find requests” checkbox allows you to set up a saved set of find criteria that is “remembered” when this script step is invoked. For instance, you may want a user to be able to click a button that always finds invoices with a date earlier than today. To set this up, you would first manually do a find yourself in the database, entering find criteria and performing the find.
Then, you would go into your script and add the “Perform Find” script step with the Restore option checked. Now whenever you run this script, these criteria are remembered and the desired set of records that match these criteria are automatically found with no Find mode or user intervention required.
EXAMPLE: This script finds all records where the Number field contains “5”. (Remember, the find criteria won’t show up in the script definition; you’ll have to print the script to see that.)Perform Find [Restore, Replace Found Set]
Modify Last Find
Restores the criteria for the last used find request, puts the user in Find mode, and allows the user to change the find criteria before performing the find.
EXAMPLE: Using the same saved find criteria as the example script for Perform Find (above), the user is taken into Find mode with that find criteria restored, and the script pauses to see if the user wants to modify the criteria.When the user continues, the specified find is performed.
Print Setup – Windows Only
Allows you to preserve a certain print settings in your script like whether to print just the current record or the found set, and the paper orientation.
OPTIONS: “Restore setup” means that FileMaker will remember the setup options in effect when the script step was last saved. These will be input into the setup dialog unless you’ve checked the “Perform without” dialog.
When checked, the “Perform without dialog” denies a user the ability to tweak the saved settings (before an inevitable Print script step that would most likely follow).
EXAMPLE: Basically, this script just goes to a certain layout and enters Preview mode after restoring a saved landscape orientation print setup. Then the layout prints.
Page Setup – Mac Only
Allows you to preserve a set of print settings in your script such as whether to print just the current record or the found set, and the paper orientation.”
OPTIONS: “Restore setup options” means that FileMaker will remember the setup options in effect when the script step was last saved. These will be input into the setup dialog unless you’ve checked the “Perform without” dialog.
When checked, the “Perform without” dialog prevents the user from tweaking the saved settings (before an inevitable Print script step that would most likely follow).
EXAMPLE: Basically, this script just goes to a certain layout and enters Preview mode after restoring a saved portrait orientation page setup. Then the layout prints.
Prints the current layout or report. You can allow a settings dialog to come up so a user can tweak the settings or print without a dialog. (Usually, though, you should have a no-dialog Page/Print Setup script step first in this case.)
OPTIONS: When checked, the “Perform without” dialog prevents a user from tweaking print settings such as the printer to use, how many copies to print, what to print, and so on. You would typically use this option to indicate that you only want your users to print in a certain way, such as to always print in triplicate, always to accounting’s printer, and so on.
EXAMPLE: See the example for the Print Setup or Page Setup script steps.
These script steps deal mainly with the types of commands generally found under an application’s Edit menu.
“Takes away” or undoes the most recent action, no matter which mode you are in, unless data has been committed to a database. FileMaker allows you to undo only the very last action; you don’t get limitless undos such as in Microsoft Word.
Cuts the contents of the current or selected text and shuttles it to the clipboard for pasting elsewhere.The following script snippet stores the contents of the clipboard before altering it by pasting into a global text field and a global container field. It pastes into both fields because we don’t know what kind of data will be in the clipboard.
Next, it checks to see which field has data in it and copies from the correct one. Although this script won’t cover all possible data types that could be found in the clipboard, it will protect the majority of them.
OPTIONS: The options follow: “Select entire contents being checked” means that everything in the field will be cut. Otherwise, only the text highlighted by the user is cut out. “Specify field” is where you pick which field you’re cutting from.
EXAMPLE: Cuts from a field, then pastes back again.
Copies but does not remove the contents of the current field or selected text and shuttles that contents to the clipboard for pasting elsewhere. The field must be on the layout.
OPTIONS: The options follow: When checked, “Select entire contents” means copy everything in the field. Otherwise, only the text highlighted by the user is copied to the clipboard. “Specify field” is where you pick which field you’re copying from.
This pastes whatever is on the clipboard into the currently selected field. If the clipboard contains data that isn’t the right type for the field you’re pasting into (such as trying to paste a time into a date field) you’ll get a validation dialog box.You can paste graphics, audio, and OLE objects (just in Windows), too. Field must be on the layout.
When checked, “Select entire contents” means the entire contents of a field will be overwritten with the contents of the clipboard. Otherwise, just the user-selected text will be overwritten.
“Paste without style” means any text style and formatting associated with the clipboard contents will be disregarded and the clipboard contents will be pasted in the default style of the destination field.
“Specify field” is where you pick which field you’re pasting into. “Link if Available” has to do with OLE objects. If this is checked, it will establish a link to that pasted object (Word file, PDF, graphic, and so on) instead of pasting the object itself.
EXAMPLE: See the Cut example.
Erases the contents of the current field or selected text, unless you do an immediate undo. Does not put anything on the clipboard.
OPTIONS: When checked, “Select entire contents” means the entire contents of a field will be wiped. Otherwise, just the user-selected text will be cleared. “Specify field” is where you pick which field you’re clearing/deleting.
EXAMPLE: Works the same as cut, but nothing is put on the clipboard.
Selects all of the contents of the currently entered field.
This feature will help you find certain bits of a database throughout the fields in a database and replace that data with something else.
OPTIONS:“Specify” brings up the find/replace dialog where you can set up what’s found, what’s replaced, which records are acted upon, whether you want to match case or whole words only and so on. This is defined in the script and is not presented to the user when running the script.
When checked, “Perform without dialog” will suppress both dialogs that come up. Otherwise, the “Are you sure?” dialog and the summary (of what was replaced and where) dialog that comes up after the find/replace is complete will appear.
EXAMPLE: This example replaces every occurrence of “6” with “6” across all fields in all records.Perform Find/Replace ["6", "6", "Replace All"]
These script steps deal mainly with manipulating data inside FileMaker fields.
Overwrites the contents of one field in the current record with something (of the same field type) specified by the user. That something can be from another field, a calculated string, or even a graphic or other binary data.
The field being set does not have to be on the current layout in order to work. The specified field can be in another database, too.
If the field being set is a related field for which there is a valid relationship, a valid related record will be created. This is very useful for creating records in another database. For instance, if you have a field called gConstant in the current database that is a calculation field set to 1 and a field called TempRelationship in the other database that is defined as a number field, and then have a relationship between the two databases based on those fields, you can set the foreign key field of the other database through this relationship and then break the temporary relationship so that such operations will work in the future.
Use “Set Field” Instead of Cut and Paste
Contrary to popular belief, the best way to shuttle data from database to database is not via cut/paste but with Set Field. Use Set Field script steps in conjunction with global fields and a constant relationship to move data. Also, don’t copy from Browse into Find mode. Use Set Field by setting information into a global field, entering Find mode, and setting the information from the global field. Because global fields are the same across all records in a database, their contents are available in Find mode. The reason to generally avoid using cut/copy/paste in scripts is that doing so will erase any information that the user may have stored in the clipboard. If you absolutely must use these clipboard-altering steps, be sure to first store the current contents of the clipboard into fields, do your cut/copy/ paste, and then restore the clipboard.
OPTIONS:“Specify field” allows you to pick which field will be overwritten. If no field is entered, FileMaker will set the field currently entered into by the user on the current layout (otherwise nothing gets overwritten).
“Specify” brings up a dialog where you’ll specify what is going to be placed into the specified field. You have access to all the same fields and functions as you do in calculation definitions If script step definitions and so on.
EXAMPLE: This is the “Copy the Ship to to Bill To” script from Company.fp5 of the computer shop database. It shows a message, asking the user if they really want to overwrite a customer’s bill to address and info with the same company’s ship to info. If the user responds no, the scripts stops. If yes, the action is completed on several fields using Set Field.
Lets you specify a custom block of text to be entered into a text-type field. Field must be on the layout.
OPTIONS: When checked, “Select entire contents” means the entire contents of a field will be overwritten with the specified text. Otherwise, just the user-selected text will be overwritten.
“Specify field” is where you pick which field you’re pasting text into. “Specify” brings up a dialog where you’ll specify what text blob is going to be placed into the specified text field.
EXAMPLE: This is the script in ScriptMakerSteps.fp5 called Insert Stuff, and it relates to the next few script steps. It basically inserts a bunch of stuff into the fields mentioned in the script.
Insert Calculated Result
This overwrites the contents of one field in the current record to something calculated, as specified by the user. This works almost like Set Field but the field being set does have to be on the current layout in order to work. The specified field can be a related field on the layout, too.
OPTIONS:“Specify field” allows you to pick which field will be overwritten. If no field is entered, FileMaker will set the field currently entered into by the user on the current layout (otherwise nothing gets overwritten).
“Specify” brings up a dialog where you’ll specify what is going to be placed into the specified field. You have access to all the same fields and functions as you do in calculation definitions, If script step definitions, and so on.
When checked, “Select entire contents” means the entire contents of a field will be overwritten with the specified calculated value. Otherwise, only the user-selected text will be overwritten.
EXAMPLE: See the example for Insert Text.
Insert from Index
This brings up a dialog showing all indexed values for the specified field, thus allowing a user to select which value to enter from that list. Indexing must be turned on for that field (or available to be turned on automatically when needed), and the field must be on the current layout for anything to happen.
This is useful for ensuring consistent data entry into your fields and works a bit like value lists (and is just as dynamic).
EXAMPLE: See the example for Insert Text.
Insert from Last Record
This overwrites the data in the specified field with data from the same field in the last active record the user was on. (Active means you changed something in a field, entered a field on that record, or the like.) Last record does not mean the record prior to the current one in the sort order (unless that was the last record “activated” by the user).
This does nothing if the field has auto-entry or “prevent modification” options set in its definition.
EXAMPLE: See the example for Insert Text.
Insert Current Date
This pastes the current date (pulled from the user’s machine) into the specified field.
EXAMPLE:See the example for Insert Text.
Insert Current Time
This pastes the current time, according to user’s machine, into the specified field.<
File Maker Related Interview Questions
|Management Information systems Interview Questions||Software Engineering Interview Questions|
|File net Interview Questions||Data analyst Interview Questions|
|Hadoop Distributed File System (HDFS) Interview Questions||Linux File Systems Interview Questions|
|Excel Data Analysis Interview Questions||Asp Dot Net Database Interview Questions|
All rights reserved © 2020 Wisdom IT Services India Pvt. Ltd
Wisdomjobs.com is one of the best job search sites in India.