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
- You have a FL0 account.
- You've read Reading multiple records from a database.
Step 1: Create a flow
- Create an HTTP Request flow.
- In the Explorer pane, click Create new.
- Select Flow.
- Type Get Task.
- Tap the Return key.
- When a dialog appears, select HTTP Request.
- Open the Start component.
- From the Method dropdown, select GET.
- In the Path field, enter /task.
- Create a query parameter for specifying the ID of a task.
- Under Query String, click the + icon.
- In the Name field, enter id.
- Enable the Required option.
- Click the X icon to close the component.
- Click Save.


Step 2: Add a "Select" component to the flow
- Drag a Select component into the flow.
- Select the component to open it.
- From the Table dropdown, select Todo > Tasks.
- In the Select tab, enable all of the fields.
- Switch to the Filter tab.
- Click the + icon.
- In the first field, select Start > QueryString: id.
- In the second field, select is equal to.
- In the third field, select Fields > Field: id
- Click the X icon to close the component.
- Click Save.


Step 3: Add an "End" component to the flow
- Drag an End component into the Get Task flow.
- Select the component to open it.
- From the Status Code dropdown, select 200 OK.
- From the Content Type dropdown, select application/json.
- In the Body field, select Select > Data.
- Click the X icon to close the component.
- Click Save.


Step 4: Run the flow
- Open the Run panel.
- In the id field, enter the ID of a task.
- 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.


Updated 8 months ago