Go to List of Records

Goes to a layout and returns the found set specified by a list of record IDs.

Options 

  • List of record IDs is the list of identifiers for the records to go to. The order of the record IDs specifies the sort order to use for the found set. The record IDs must be valid record identifiers in the table associated with the specified layout. For supported list formats, see Description.

  • Show record using layout specifies the layout in the current file that will be used to display the records from the list. If no layout is specified, the current layout is used.

  • Show in new window shows the related records in a new window and lets you specify the settings for the new window. See New Window script step.

    Tip  To bring the new window to the front automatically, add the Select Window script step.

  • Animation specifies the animation to use when displaying the records (FileMaker Go only).

Compatibility 

Product Supported
FileMaker Pro Partial
FileMaker Go Yes
FileMaker WebDirect Partial
FileMaker Server Partial
FileMaker Cloud Partial
FileMaker Data API Partial
Custom Web Publishing Partial

Originated in version 

22.0

Description 

This script step goes to the specified layout in the current window (or in a new window). It then changes the found set of records and its sort order to those specified by List of record IDs and goes to the first record in that set.

You can specify the List of record IDs option in any of these formats:

Format for List of record IDs Examples Notes

List of values

Copy
1
5
21
22
23
7
Copy
1
5
21-23
7
See ValueCount for supported separator characters.

JSON array of values

Copy
[1,5,21,22,23,7]

["1","5","21","22","23","7"]

["1","5","21-23","7"]

Record IDs can be JSON numbers or strings.

JSON array of objects with a recordId key-value pair

Copy
[
  {
    "recordId" : "1"
  },
  {
    "recordId" : "5"
  },
  {
    "recordId" : "21"
  },
  {
    "recordId" : "22"
  },
  {
    "recordId" : "23"
  },
  {
    "recordId" : "7"
  }
]

Find requests performed by the Perform Semantic Find script step and Execute FileMaker Data API script step return JSON in a compatible format.

Consecutive record IDs can be given as a range (two numbers separated by a hyphen) in a list of values (for example, 21-23) or in a JSON array of strings (for example, ["21-23"]). A range in a JSON array of numbers is invalid JSON, which causes this script step to return an error.

If any of the specified record IDs can't be found (for example, if records have been deleted), those IDs are ignored and the found set will contain only the records that were successfully located. The records in the resulting found set are displayed in a sort order that matches the sequence of the provided record IDs. In the Sort Records dialog, this sort status is indicated by <Predefined Order>.

Notes 

  • Record IDs must be valid record identifiers assigned by the FileMaker client when the record was created. These are the same record IDs used elsewhere, such as those returned by the Get(RecordID) and GetRecordIDsFromFoundSet functions and FileMaker Data API and OData API calls. Primary key field values or other custom identifiers aren't supported.

  • If any of the specified records can't be found, this script step returns error code 101 ("Record is missing") or 401 ("No records match the request"), which can be captured with the Get(LastError) function.

  • When this script step opens a new window, the new window doesn't activate the OnFirstWindowOpen script trigger or the OnWindowOpen script trigger, because the triggered script may not go to the desired layout or view. If you want a script performed after this script step opens a new window, add Perform Script as the next script step.

  • The Animation option is supported only in FileMaker Go:

    • You can use animations only for the selected window.

    • You can't use animations for navigating between records by using the slider or the status toolbar buttons.

Example 1 - Go to records in a list of values

Goes to the Contacts layout and displays records specified by a carriage return-delimited list of record IDs.

Copy
Set Variable [ $recordList ; Value: "15¶8¶23¶4¶12" ]
Go to List of Records [ List of record IDs: $recordList ; Using layout: "Contacts" (Contacts) ]

Example 2 - Go to records from a saved semantic find

The semantic find performed in Example 2 in Perform Semantic Find saved the list of records in $$result as a JSON array of objects with recordId key-value pairs. (Notice that the JSON format of the saved result of the find is compatible with that of Go to List of Records.) Later in the same FileMaker client session, this script opens a new window, goes to the same layout (Meeting Details), and displays the same found set. If unsuccessful, the script displays an error message.

Copy
Go to List of Records [ List of record IDs: $$result ; Using layout: "Meeting Details" (Meetings) ; New window ]

If [ Get ( LastError ) ≠ 0 ]
    Show Custom Dialog [ "Error" ; "Could not go to the specified records. Error: " & Get ( LastError ) ]
End If

Example 3 - Recreate client's found set on host

Performs a find on the FileMaker client for products with low inventory (< 50), then gets the record IDs of the found set using the GetRecordIDsFromFoundSet function. The client script then calls a script on the host and passes it the list of record IDs.

Copy

Client script

Go to Layout [ "Products (Products) ; Animation: None ]
Enter Find Mode [ Pause: Off ]
Set Field [ Products::Inventory ; "<50" ]
Perform Find [ ]

Set Variable [ $foundSetIDs ; Value: GetRecordIDsFromFoundSet ( ValueNumberRanges ) ]

Perform Script on Server [ "Host script" ; Specified: From list ; Parameter: $foundSetIDs ; Wait for completion: On ]

Show Custom Dialog [ "Result" ; Get ( ScriptResult ) ]

The host script goes to the list of records on the Products layout, calculates the result, then passes the result back to the client script.

Copy

Host script

Set Variable [ $recordIDs ; Get ( ScriptParameter ) ]
Go to List of Records [ List of record IDs: $recordIDs ; Using layout: "Products" (Products) ; Animation: None ]

# Process records in found set and return $result
Exit Script [ Text Result: $result ]