Link Search Menu Expand Document

Fetch/Display one Record using Datasource

Tip: You can use Manage Records to list the database’s Records without running the application.

To display a Record from the database in your application, you will need to add a Fetch/Display one Record Datasource. This Datasource is required in order to specify when to load the Record and how to display it.

  1. Navigate to the Screen that you want to add the Datasource.
  2. Press the Datasource button, and then the + Create datasource button.
  3. Select the Kodika Server tab.
  4. Select the Data Type that you want to fetch a record from.
  5. Select Fetch/Display one Data Type Name.
  6. Select the Record to fetch.
  7. Connect at least the parameter of the On Success response.
  8. Press Save.
  9. Close Datasource popup.
  10. Create a Start a Datasource Request Event Action and connect it to an Event, if needed.

Select the Record to fetch

There are two ways to reference a Record in the database.

  1. Direct, using its record id.
  2. Indirect, using one or more relationships that point to the Record.

Examples with Direct reference:

  • You have a Category Data Type, and you want to display a specific category in your app’s Dashboard. You will directly select this Category’s id.
  • You have a List of Followers, and a specific User is selected from the list. You can use this selection to get the User/Record Id and then bind the fetched Record to the next Screen.

Examples with Indirect reference:

  • You have a User Data Type that has an One to One Relationship with a Pet Data Type. You can fetch the current user’s pet by selecting the User -> Pet option and then select the Current User.
  • You have a Category Data Type that has an One to One Relationship to a Post Data Type. Post Data Type has an One to Many Relationship to a Genre Data Type. You can access the genre of a post of a category by selecting the Category -> Post -> Genre option and then bind a value for the Category.

Request Parameters

Filter

Change the record that will be fetched.

Responses

Note: If any of the validations failed, the On Success response is not called, and only the respective failure response is called.

On Success

Called when the Record is fetched.

Parameters:

  • record: The requested record.

On Error

Called when there is an unknown error that is not handled by the other responses.

Parameters:

  • Error: A text with an error message.

When Wrong Filter Value

Called when the the root record to fetch from does not exist.

Parameters:

  • Error: A text with an error message.

When Offline

Called when the user has no Internet connection.

Parameters:

  • Error: A text with an error message.