Quick Start - MySQL
This guide introduces building an internal management interface for a company, implementing the following functionalities:
- Display a list of users.
- Search by username.
- Change a user's email address.
Data Integration
We will be using [Onboarding DB] which is already connected, so no setup for connection is required.
If you need to connect your own data source, please see here.
Building the Management Interface
Placing Screen Labels
- Drag & drop [Text] from the right [Components] onto the canvas.
- Enter
User List
in [Text] on the right [Inspect]. - Change the size to
large
in the right [Inspect] under [Size].
Displaying User List in a Table
- Drag & drop [Table] from the right [Components] below the [Text] you placed.
- Click [Create] in [Dataflows].
- Change the name of the dataflow to
listUsers
in the text input under [Dataflow]. - Select [Onboarding DB], a MySQL data source.
- Write the following SQL in [SQL]:
SELECT * FROM users LIMIT 20;
- Click [Run] next to
listUsers
. - Click the placed [Table] and change the [Data] in the right settings to
{{ listUsers.data }}
to map the data.
Search by Username
- Drag & drop [Input] from the right [Components] between [Text] and [Table].
- Enter
Search by Email Address
in [Label] on the right [Inspect]. - Select the previously created
listUsers
dataflow and choose [action1]. - Modify [SQL] to:
SELECT * FROM users WHERE email LIKE '%{{ input1.value }}%' LIMIT 20;
- Turn on [Run automatically on inputs change].
Change User's Email Address
- Drag & drop [Column] onto the canvas from the right [Components].
- Move the already placed table to the left side of the [Column].
- Place a new [Input] on the right side of the [Column].
- Enter
Update Email Address
in [Label] in the [Inspect] for the input placed in step 3. - Enter
{{ table1.selectedRow.data.email }}
in [Default value] in the [Inspect] for the input. - Place a [Button] below the input placed in step 3.
- Enter
Update
in [Label] in the [Inspect] for the button placed in step 6. - Adjust the width by moving the adjuster of [Column].
- Return to [Dataflow] and click [Create].
- Change the name of the dataflow to
updateUserEmail
in the text input under [Dataflow]. - Select [Onboarding DB], a MySQL data source.
- Write the following SQL in [SQL]:
UPDATE users
SET email = '{{ input2.value }}'
WHERE id = {{ table1.selectedRow.data.id }};
- Select
listUsers
in [Success events]. This ensures that afterupdateUserEmail
is executed,listUsers
is run, keeping the table information up to date. - Click [Add Event] in the [Inspect] for the button placed in step 6.
- Select
updateUserEmail
in [Dataflow]. This ensures thatupdateUserEmail
is executed right after the button is pressed.