fmAddRecord ( database [, field-values ]) |
Returns: integer | Location: FileMakerLib | ||||||
Adds a new record to database and returns the new record's ID number as an integer. The optional field-values parameter may be used to set the field contents of the new record, rather than using an additional function call. You may optionally specify a layout, with the database parameter as a list in the format [ database-name layout-name ]. However, fields which are defined in the database, but are not in the layout specified will not be available. Both of the examples below perform the same action, one demonstrating the use of the field-values parameter rather than having to use fmSetRecord(). Examples:
See Also: |
fmCloseDatabase ( database ) |
Returns: null | Location: FileMakerLib | ||||
Closes the database whose name is database. To be used again, the database must be opened using the fmOpenDatabase() function. Example: fmCloseDatabase("Customers"); See Also: |
fmCountFields ( database ) |
Returns: integer | Location: FileMakerLib | ||||
Counts the number of defined fields in database and returns the count as an integer. You may optionally specify a layout, with the database parameter as a list in the format [ database-name layout-name ]. However, fields which are defined in the database, but are not in the layout specified will not be available. Example: num_fields = fmCountFields("Customers"); // num_fields will be equal to 3 |
fmCountMatching ( database [, query-list ]) |
Returns: integer | Location: FileMakerLib | ||||||||||||||||||||||||||||||||||||||
Returns the total number of records that match the query specified using query-list. This function is helpful when used in conjunction with the start-with and max-hits parameters in fmLookup() or fmRetreive() allowing you to retrieve matching records in smaller chunks. The database name to search is specified by the database parameter. You may optionally specify a layout, with the database parameter as a list in the format [ database-name layout-name ]. However, fields which are defined in the database, but are not in the layout specified will not be available. The query-list parameter is a structured list specifying the type of query to perform. The query-list may contain either a single, simple query or a more complex, multiple field query. See the examples below as a demonstration of creating both simple and complex queries using this parameter. The query-list parameter should use the structure:
Valid values for compare-op are:
Each of the examples below demonstrate various levels of query complexity and return number of matching records. Examples:
See Also: |
fmCountRecords ( database ) |
Returns: integer | Location: FileMakerLib | ||||
Returns the total number of records in database. Example: num_customers = fmCountRecords("Customers"); print "We have served " & num_customers & " customers!"; |
fmDoScript ( database, script-name) |
Returns: null | Location: FileMakerLib | ||||||
Runs the specified FileMaker script whose name is script-name. The named script must be a valid script already defined in database. |
fmGetDatabases ( ) |
Returns: list | Location: FileMakerLib |
Returns a list of all databases currently open and available for use. Example: db_list = fmGetDatabases(); num_databases = sizeOf(db_list); print num_databases & " databases available: " & db_list; >> 3 databases available: Catalog Customers Orders See Also: |
fmGetFieldInfo ( database, field ) |
Returns: list | Location: FileMakerLib | |||||||||||||||||||||||||||||||
Returns a structured list containing the definition of the field specifed by field in database. The field parameter may be the field's name or its sequential index number in the database. The database name is specified by the database parameter. You may optionally specify a layout, with the database parameter as a list in the format [ database-name layout-name ]. However, a field which is defined in the database, but is not in the layout specified will not be available. To get field definitions for all defined fields in a database, refer to fmGetFields(). The returned list has the following structure:
See Also: |
fmGetFields ( database ) |
Returns: list | Location: FileMakerLib | |||||||||||||||||||||||||||||
Returns a structured list describing all the defined fields in database. You may optionally specify a layout, with the database parameter as a list in the format [ database-name layout-name ]. Specifying a layout will retrieve field definitions from FileMaker that are available in the named layout. However, any fields which are defined in the database, but are not in the layout specified will not be returned. Each item in the returned list is a sub-list with the following structure:
See Also: |
fmGetLayouts ( database ) |
Returns: list | Location: FileMakerLib | ||||
Returns a list of the defined layouts in database. Example: layout_list = fmGetDatabases("Customers"); num_layouts = sizeOf(layout_list); print num_layouts & " layouts available: " & layout_list; >> 3 layouts available: Download Info, Full Record, Mailing Labels See Also: |
fmGetRecord ( database, record-id [, return-fields ]) |
Returns: list | Location: FileMakerLib | ||||||||
Given a record ID in record-id, this function will return the contents of the record specified in the database specified. If you do not want all the fields in a record returned, use the optional return-fields parameter to specify which fields to return, and in what order. Including the special field "----" in return-fields will return the record's ID number in the results. You may optionally specify a layout, with the database parameter as a list in the format [ database-name layout-name ]. Specifying a layout will retrieve field values from FileMaker as they are formatted in the named layout. However, fields which are defined in the database, but are not in the layout specified will not be available. Example:
See Also: |
fmGetRecordID ( database, record-number ) |
Returns: integer | Location: FileMakerLib | ||||||
Given a record's sequential number in record-number, the record's internal ID is returned. The name of the database is specified by the database parameter. Example: // get the 50th record in "Customers" database record_id = fmGetRecordID("Customers", 50); the_customer = fmGetRecord("Customers", record_id); |
fmLookup ( database [, query-list, sort-fields, start-with, max-hits ]) |
Returns: list | Location: FileMakerLib | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
This function is used to search for records in a database that match a given query. A list containing the record ID numbers of all records matching the query is returned. To receive actual field values for any returned record, you must use fmGetRecord. The database name to search is specified by the database parameter. You may optionally specify a layout, with the database parameter as a list in the format [ database-name layout-name ]. However, fields which are defined in the database, but are not in the layout specified will not be available. The query-list parameter is a structured list specifying the type of query to perform. The query-list may contain either a single, simple query or a more complex, multiple field query. See the examples below as a demonstration of creating both simple and complex queries using this parameter. The query-list parameter should use the structure:
If you want the returned results sorted, the optional sort-fields parameter may be used to designate a field or fields to sort by. If you wish to sort by multiple key fields, the sort-fields parameter should be a list of sub-lists. If the sort order isn't defined, the default is "ascending". Each sub-list in the sort-fields parameter should use the structure:
The start-with and max-hits parameters are used to return a subset of the total matching records. For example, if there are 125 matching records (this can be determined using the fmCountMatching() function) and you only want blocks of 25 at a time, set max-hits to 25 and start-with to 25 * the number of the results block to be shown (0 for the first block of 25, 1 for the second block of 25, and so forth). This functionality is very useful when returning the results of large queries in an organized and quick fashion. See the last example below for further reference. Valid values for compare-op are:
Each of the examples below demonstrate various levels of query complexity and return a list of record ID numbers. To retrieve actual record data, you must use the fmGetRecord() function. To query and receive results using a single function, use fmRetrieve(). Examples:
See Also: |
fmOpenDatabase ( database-path [, password ]) |
Returns: null | Location: FileMakerLib | ||||||
Given the full path to a database file in database-path, this function will open the database therefore making it available for use. If the database has been protected by a password within FileMaker, it may be specified using the optional password parameter. This function does not work correctly when directing a remote copy of FileMaker using the FileMakerLib's auto-login functionality, only when WebSiphon and FileMaker are present on the same machine. Examples:
See Also: |
fmRemoveRecord ( database, record-id ) |
Returns: null | Location: FileMakerLib | ||||||
Permanently removes the record whose ID is record-id from the database. The name of the database is specified by the database parameter. Warning: This operation is not reversible! Example: // Remove all customers in the database whose last name // starts with "a" the_a_list = fmLookup("Customers", [["lnam" "starts with" "A"]]); repeat with delete_id in the_a_list fmRemoveRecord("Customers", delete_id); end repeat; See Also: |
fmRetrieve ( database [, query-list, return-fields, sort-field, start-with, max-hits ]) |
Returns: list | Location: FileMakerLib | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
This versatile function performs a query much like fmLookup(), but rather than returning record ID numbers, it returns the actual record data. This removes the need to repeatedly get each record to access data returned based on a query. The database name to search is specified by the database parameter. You may optionally specify a layout, with the database parameter as a list in the format [ database-name layout-name ]. Specifying a layout will retrieve field values from FileMaker as they are formatted in the named layout. However, fields which are defined in the database, but are not in the layout specified will not be available. The query-list parameter is a structured list specifying the type of query to perform. The query-list may contain either a single, simple query or a more complex, multiple field query. If query-list is not provided, all record data will be returned. See the examples below as a demonstration of creating both simple and complex queries using this parameter. Each sub-list in the query-list parameter should use the structure:
Using the optional return-fields parameter specifies which fields will be retrieved from all records matching the query. This is particularly useful for large databases where you are only interested in a few of the fields. The returned list will contain each field requested, in the order specified. Additionally, including the special field "----" in return-fields will return the record's ID number in the results. If you want the returned results sorted, the optional sort-fields parameter may be used to designate a field or fields to sort by. If you wish to sort by multiple key fields, the sort-fields parameter should be a list of sub-lists. If the sort order isn't defined, the default is "ascending". Each sub-list in the sort-fields parameter should use the structure:
The start-with and max-hits parameters are used to return a subset of the total matching records. For example, if there are 125 matching records (this can be determined using the fmCountMatching() function) and you only want blocks of 25 at a time, set max-hits to 25 and start-with to 25 * the number of the results block to be shown (0 for the first block of 25, 1 for the second block of 25, and so forth). This functionality is very useful when returning the results of large queries in an organized and quick fashion. See the last example below for further reference. Valid values for compare-op are:
Each of the examples below demonstrate various levels of query complexity and return actual record data. Examples:
See Also: |
fmSetRecord ( database, record-id, field-values ) |
Returns: null | Location: FileMakerLib | ||||||||
Modifies the value of one or more fields in the record whose ID is record-id. The field-values parameter is a list of field name and value pairs which are to be modified in the record. The name of the database is specified by the database parameter. You may optionally specify a layout, with the database parameter as a list in the format [ database-name layout-name ]. However, fields which are defined in the database, but are not in the layout specified will not be available. Example: fmSetRecord("Users", rec_id, [["Password" new_password]]); See Also: |