Overview
In this lesson we are going to review Wayfast Datasets. A dataset allows us to connect a page with a data source like a database or an API. To depict how it works we will show you and example that include calling a database store procedure for retrieving information and displaying it in a Wayfast Application.
Preconditions
We have 3 important preconditions before start working with Datasets.
...
A popup is displayed, click on “Synchronize” button. Now the stored procedure created in database will be available to connect with dataset.
How to create a new Dataset?
Go to “Project Pages” at top menu. Select any of the pages available in the project. Then click on “New Dataset” button
...
A popup is displayed and we need to complete the mandatory fields.
...
Execution Type field is an important feature since this will define what type of performance has the dataset.
Execution Type | Description |
---|---|
Pre | Allows to execute the dataset while the page is loaded which is helpful to get the information available from the very beginning. |
Post | Allows to bring the Information requested in the moment that we trigger any action and depending the size of the response, it could take some time after the information is loaded on the screen |
On-demand | Runs every time there is a post back. Post-backs are interactions with the backend / web app. In general, we recommend avoiding controls that are loaded on demand so that screen reloads are not generated all the time. |
Turn to In this example, we are going to select “Pre” so we can have our data refreshed at the moment we enter to the page.
After this, focus on “Data Binding” tab in “New Dataset” popup. In this section, we can select the Stored Procedure previously created for the information available in DB.
...
If we click on “Add relationship” button under “Control Run” “Dataset Refresh Binding” field, we can link the Dataset with Controls inside the “Data Binding”. For more information, we can find an dataset with any of controls. We can find another example in “Actions” lesson.
After that simply completing this details, click on “Accept” button to save the dataset. Now Stored Procedure can be quickly referenced from other controls in this page.
This is how it looks like:
...
How to connect the new Dataset with a “Grid Column” control?
Let’s create an example using grid columns linked to the new dataset. Table on database refers to “Name”, “Role” and “Email”. We need to create 3 controls related to this 3 columns.
Turn to the page where we are going to include this object. Under the “Controls” section, choose the “Grid Column” option. Click on “New” button
Info |
---|
You can find more details regarding the properties on “Grid Column” “Grid Column” control lesson. |
...
A popup will be prompted to generate the control.
...
Turn to “Data Binding” tab and connect to a previously generated dataset.
...
Complete the required fields, make sure that the new control has the same value than the one in table generated and associated to the stored procedure.
...
Turn to “Layout” tab and indicate the order where we want to display this column. In our example, we have want to display a table created and we want to add this new column at the right side.
...
Click on “Submit” button
...
Now that we have the grid columns created, we can click on “Grid_Column” link in “Control” column in the row we want to bind . A popup is displayed with the information related to the control. with 3 columns as we previously mentioned.
...
Turn to “Data Binding” tab
...
Change the “Dataset” dropdown with the new dataset that Wayfast will retrieve according to the previous step in the lesson. Click on “Accept” and connect to the dataset previously generated in the page. Dropdown will retrieve this information to connect the control.
...
Click on “Submit” button
Info |
---|
If page has multiple grid columns to reassign, we can use “Massive Mod” button which is a feature to easily make the bulk change. |
...
Repeat the steps for each column in the table “HWD_Roles
" created in database.
...
Resuming our lesson, we created a table and stored procedure in database. Then we created a page to display the values that we have in this table. Dataset is needed to connect the information in database and the controls (grid columns) that will be pointing to the data.
Let’s review how this interaction is displayed on the preview
...
All the information in the table is now available in the page. In the following lesson, we are going to analyze how we can insert values on the table using “Actions” feature.
Recap
We learnt about the importance of Datasets to interact with database and how the Store Procedure is needed for this purpose. We explained how some type of controls are specifically created to show the information from the Dataset to make it available at the moment we open the page.