Reading a single record

In FL0, retrieving a single record from a database is similar to retrieving multiple records. The main difference is using the filtering features of the Select component to retrieve a specific record.

This tutorial uses a to-do list management application as an example to demonstrate how to retrieve a single record from a database.

Prerequisites

Step 1: Create a flow

  1. Create an HTTP Request flow.
    1. In the Explorer pane, click Create new.
    2. Select Flow.
    3. Type Get Task.
    4. Tap the Return key.
    5. When a dialog appears, select HTTP Request.
  2. Open the Start component.
  3. From the Method dropdown, select GET.
  4. In the Path field, enter /task.
  5. Create a query parameter for specifying the ID of a task.
    1. Under Query String, click the + icon.
    2. In the Name field, enter id.
    3. Enable the Required option.
  6. Click the X icon to close the component.
  7. Click Save.

Step 2: Add a "Select" component to the flow

  1. Drag a Select component into the flow.
  2. Select the component to open it.
  3. From the Table dropdown, select Todo > Tasks.
  4. In the Select tab, enable all of the fields.
  5. Switch to the Filter tab.
  6. Click the + icon.
  7. In the first field, select Start > QueryString: id.
  8. In the second field, select is equal to.
  9. In the third field, select Fields > Field: id
  10. Click the X icon to close the component.
  11. Click Save.

Step 3: Add an "End" component to the flow

  1. Drag an End component into the Get Task flow.
  2. Select the component to open it.
  3. From the Status Code dropdown, select 200 OK.
  4. From the Content Type dropdown, select application/json.
  5. In the Body field, select Select > Data.
  6. Click the X icon to close the component.
  7. Click Save.

Step 4: Run the flow

  1. Open the Run panel.
  2. In the id field, enter the ID of a task.
  3. Click Run.

If the Show Debug option is enabled via the Output tab, the retrieved data — in this case, an array that contains a single task — appears in the logs.