Skip to end of metadata
Go to start of metadata

You are viewing an old version of this content. View the current version.

Compare with Current View Version History

« Previous Version 8 Next »

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 2 important preconditions before start working with Datasets.

  1. We need to connect the project with an existing or new database. You can find more details about in another lessons where we attached or created databases.

  2. We need to create an object in this database, for example, an 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

Stored Procedure will have 2 parameters named as @data1 and @data2. Let’s execute the query to create the object in the database.

Now we can go back to Wayfast and synchronize the stored procedure in the environment. If the project is newly created and connected to a database, there’s no need to synchronize both objects. Dataset will retrieve all the objects associated between both entities automatically.

Let’s review how synchronize the objects in Wayfast. Keep in mind this action must be triggered inside the project before enter to the page where we are going to create the new dataset. Otherwise the stored procedure won’t be available in search field.

On Wayfast, focus on the active task at left side navigator page.

Click on “End Task” button related to project’s requirement.

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 “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.

After that simply 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?

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 in “Control” column in the row we want to bind . 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 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.

  • No labels