Skip to main content

Move a cursor to beginning

Prerequisites:

Note

The listed prerequisites need to be run successfully before performing this procedure.

  1. Complete the tutorial setup.

  2. Create a table.

  3. Create an index on the name field.

  4. Insert records.

  5. Use cursor to get records by index.

This procedure returns records in "id" order starting with the record that has the "id" field set to 4. A cursor that starts returning records can retrieve records from the "athlete" table in sorted order.

Note

The user has the ability to toggle between the property "startFrom" and "beforeFirstRecord" to position the cursor before the first record. In this procedure the index used is created using each athlete records "id", and will return all athletes that have an "id" greater than or equal to 4.

  1. Paste this code into the API Request editor.

    {
        "api": "db",
        "action": "getRecordsFromCursor",
        "params": {
            "cursorId": "clickApplyDefaultsToReplaceThisWithTheLastCreatedCursor",
            "fetchRecords": 1
        },
        "authToken": "clickApplyDefaultsToReplaceThisWithValidAuthToken"
    }
    
  2. Click Apply defaults to JSON request (Apply) to set the "authToken" to a valid value.

  3. Click Send request (Run Icon).

  4. Verify the action completed successfully.

    Note

    "errorCode" with a value of 0 indicates success. "errorCode" with a non-zero value indicates a failure. See Errors and contact FairCom for more information about an error.