Running a script before sorting a result set use the

  • No School
  • AA 1
  • kittyrbw5
  • 105

This preview shows page 76 - 78 out of 105 pages.

Running a script before sorting a result set Use the setPreSortScript() method to specify a script that is run after a Find result set is generated, but before the result set is sorted. See “Using the Find command” on page 82. Example Running a script after the result set is generated Use the setScript() method to specify a script that is run after a Find result set is generated. See “Using the Find command” on page 82. Example Script execution order You can specify the setPreCommandScript() , setPreSortScript() , and setScript() methods in conjunction with the setResultLayout() and addSortRule() methods for a single command. Here is the order in which FileMaker Server and the Web Publishing Engine process these methods: 1. Run the script specified on the setPreCommandScript() method, if specified. 2. Process the command itself, such as a Find or Delete Record command. 3. Run the script specified on the setPreSortScript() method, if specified. 4. Sort the Find result set, if the addSortRule() method was specified. 5. Process the setResultLayout() method to switch to a different layout, if this is specified. 6. Run the script specified on the setScript() method, if specified. 7. Return the final Find result set. If one of the above steps generates an error code, the command execution stops; any steps that follow are not executed. However, any prior steps in the request are still executed. For example, consider a command that deletes the current record, sorts the records, and then executes a script. If the addSortRule() method specifies a nonexistent field, the request deletes the current record and returns error code 102 (“Field is missing”), but does not execute the script. The layout specified for the newFindCommand() method is used when processing the find request. When the setResultLayout() method switches to another layout, the error object for the find request based on the original layout is no longer available. To test the error object from the find request based on the original layout, check the error object before changing the layout. $findCommand = $fm->newFindCommand('Students'); $findCommand->setPreSortScript('RemoveExpelled'); $findCommand = $fm->newFindCommand('Students'); $findCommand->setScript('myScript','param1|param2|param3');
Image of page 76
Chapter 8 | Using the FileMaker API for PHP 77 Example Working with FileMaker layouts A layout is the arrangement of fields, objects, pictures, and layout parts that represents the way information is organized and presented when the user browses, previews, or prints records. The FileMaker class defines several methods that allow you to work with the layouts defined in a FileMaker Pro database. You can get information about layouts from several of the FileMaker class objects. request = $fm->newFindCommand('Students'); $request->addFindCriterion('Day', 'Wednesday'); // Perform the Find $result = $request->execute(); if (FileMaker::isError($result)) { if ($result->code = 401) { $findError = 'There are no Records that match that request: '. ' (' .
Image of page 77
Image of page 78

You've reached the end of your free preview.

Want to read all 105 pages?

  • Fall '19
  • World Wide Web, FileMaker, FileMaker Pro, Custom Web Publishing Guide

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture