Overview
The purpose of this lesson is explain the Dataset in Wayfast. This entity allow us to connect the Controls with our Project DB and bring the information to make it available in any page whenever is needed.
Preconditions
We need to create a Stored Procedure to interact with Dataset information
CREATE PROCEDURE spHola_Mundo_AccionesTest_Insert @Data1 nvarchar(50) @Data2 nvarchar(50) AS BEGIN INSERT Hola_Mundo_AccionesTest(Data1,Data2) SELECT @Data1, @Data2 END GO
This SP will have 2 parameters. Once that the Stored Procedure is created, we can go back to Wayfast application and synchronize the SP in the environment.
On Wayfast, focus on the left side navigator page and click on “End Task” button related to project’s requirement.
This step is only needed for synchronization of the Stored Procedure generated in DB.
How to create a new Dataset?
Turn 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 “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” field, we can link the Dataset with Controls inside the “Data Binding”. For more information, we can find an example in “Actions” lesson.
Click on “Accept” button.
Now that we have our entity created, we know better how this Dataset will execute the Stored Procedure that we select and consequently the information can be displayed on the page from the very beginning.
Let’s verify the information available from DB and connect them to the Project, we need to make it visible in the application’s layout.
How to connect the new Dataset with Grid controls created?
If we create a new dataset and the page already has controls associated to a different dataset, let’s focus on “Controls” section. In this example, we have 3 grid columns linked to an old dataset.
Click on “Grid_Column” link at “Control” column in each row that want to reassign. A popup is displayed with the information related to the control. 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” button
If page has multiple grid columns to reassign, we can use “Massive Mod” button which is a feature to easily make the bulk change.
Recap
We learnt about the importance of Datasets to interact with DB 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.