In addition to the commands covered so far, XSLT-CWP has a lengthy list of other commands and parameters that you can pass as part of the query string. This section lists and explains them briefly. For a more detailed reference, see this books companion volume, FileMaker 8 Functions and Scripts Desk Reference.
As you know, each Custom Web Publishing URL contains a query string, and that query string can supply at most one database command. Commands covered so far include -find, -findall, -delete, -new, and -edit. Commands are supplied as a single name with no associated value. Table 23.3 contains the full list.
Table 23.3. Custom Web Publishing Database Action Commands
Command Name | Command Effect |
---|
-dbnames | Returns an XML document containing the names of all databases available on the given FileMaker Server that are enabled for Custom Web Publishing. |
-delete | Deletes a specific record. Requires that a -recid parameter be sent to identify the record to delete. |
-dup | Duplicates a specific record. Requires that a -recid parameter be sent to identify the record to duplicate. |
-edit | Updates a record, according to whatever name-value pairs are passed with the request (generally taken from an HTML form). Requires a -recid parameter indicating which record to edit. |
-find | Performs a search, either based on field values sent as name-value pairs, and/or on a specified -recid. Can be modified by optional parameters for sort order, field operators, and logical operators. |
-findall | Finds all records in the database. |
-findany | Finds a random record. |
-layoutnames | Requires a -db parameter to specify a database to query. Returns an XML document with a list of names of all the layouts in the specified database. |
-new | Creates a new record based on whatever name-value pairs accompany the request. |
-process | Can be used only with XSLT stylesheets, and causes the stylesheet to be processed without any interaction with FileMaker Server. |
-scriptnames | Like -layoutnames, but provides a list of all script names in a database. |
-view | Requires that -db and -lay be specified. If the requested grammar is FMPXMLLAYOUT, this command retrieves detailed layout information for the specified layout (this includes things such as the contents of value lists). If the FMPXMLRESULT or fmresultset grammar is specified, this retrieves just the metadata section of the XML document. |
In addition to a single database command, Custom Web Publishing URLs can contain other parameters. Some are mandatory, such as -db, and (generally) -lay and -grammar. Others, such as -lop and -sortfield, are particular to specific commands. Table 23.4 shows a list of the most important ones. For an exhaustive list, see this books companion volume, FileMaker Functions and Scripts Desk Reference.
Table 23.4. Other Custom Web Publishing URL Parameters
Parameter Name | Parameter Effect |
---|
-db | Name of the database on which to act. Mandatory for all commands except for -dbnames and -process. Do not include a filename extension (such as .fp7) when using this parameter. |
-encoding | Use this to specify the encoding for an XSLT stylesheet. |
-field | Use the -field parameter with the name of a container field to request the contents of the container field. |
fieldname | Use plain unadorned field names as query parameters when sending data for use with the -new, -find, and -edit commands. See "Performing Specific Searches with CWP URLs," earlier in this chapter. |
Fieldname.op | Sets the comparison operator for fieldname when performing a search. (See the table of operators earlier in this chapter.) |
-grammar | For XSLT stylesheets, specifies the grammar of the underlying XML. |
-lay | Specifies which layout (and hence which table context) to use for the request. Mandatory with all commands except -process, -dbnames, -layoutnames, and -scriptnames. |
-lay.response | Enables you to use one layout for processing the command contained in a URL, and a different layout for generating the XML that comprises the response. For example, you might want to process your request (an Add, say) via a layout with certain hidden fields on it, but process the response via a layout that omitted those fields. Data could thus be added to the hidden fields, but that hidden data would then be omitted from the response. |
-lop | Used with the -find command, specifies whether to treat the search as an and search or an or search. |
-max | Used with the -find command, specifies the maximum number of records to return. Sending a parameter of -max=all permits all records to be returned. (This is the default.) |
-modid | FileMakers modification ID is an internal number that increments every time a record is changed. Use the -modid parameter to ensure that the record you
e editing has not been edited since the time you last checked the modification ID. This is useful for prohibiting different users changes from overwriting each other. |
-recid | Specifies which record should be affected by a given action. This parameter is mandatory with -edit, -delete, and -dup, and can also be used with -find. |
-script | Use this parameter to run a FileMaker script during the processing of the request. By default the script runs after the query command and any sorting have occurred. For example, you run a script in your FileMaker solution after each new record is created, you can create a URL with the -new command that also includes the -script parameter for that post-creation script. |
-script.prefind | If your command URL involves any kind of find request, use this parameter to request a script to be run before the specified search takes place. |
-script-presort | If your command URL involves any kind of find request and a sort, use this parameter to request that a script be run after the specified search takes place, but before sorting. |
-skip | Used with the various search commands, specifies that records should be returned starting elsewhere than at the first record. If you specify -skip=10, the records are returned starting with the eleventh record. |
-sortfield.[1-9] | Specify any of up to nine different fields to sort by. |
-sortorder.[1-9] | For a given sort field, specify whether it should sort ascending or descending. |
-styletype | Used in conjunction with -stylehref. Use these two parameters to specify a client-side stylesheet for additional processing. The most common choices would likely be CSS and XSLT. For these choices, you would specify -styletype=text/css or -styletype=text/xsl. |
-stylehref | Use this in conjunction with -styletype to specify the location of a stylesheet for client-side processing. Note that this option and the previous one are effective only when the users client (generally a browser) supports some form of client-side stylesheet processing. |
-token.[string] | Use to pass additional data from one stylesheet to another. See "Using Tokens to Share Data Between Stylesheets," earlier in this chapter, for more detailed information. |