Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Overview

In this documentlesson, we will explain how the Pages that we used on the Application are defined by Controls and how these controls need to be linked by Actions that are necessary to establish an interaction between DB and the Application’s UI.

How to create a Table and Stored Procedure in Project DB?

 

It’s important to reinforce the idea that all the Project’s information come from the DB through Stored Procedures (SP) and these data is readable in the Application through the Controls. This document will show that there’s another way to interact with the DB information creating Actions that can modified the information in our DB

...

 

This table has 3 columns “Nombre”“Name”, “Cargo” “Role” and “FecIni”“IniDate”. Then we can proceed to create a Stored Procedure related to “Test Empleados” Employees” that will insert new values and consequently will select and display the new input information.

...

Now we have the new objects available in Wayfast Application to associate with Controls and Actions.

How to create Controls to interact with Application?

 

To begin, navigate to Pages and open a specific Page’s Detail form. In another document, we learnt how to create new Controls. Focus on Controls section. Then select “Inputbox” control and click “New” button

...

At this point, it’s important to follow the structure that we previously defined in “Test Empleados” db table. In this case, we are going to create only 2 inputbox controls for “Nombre” “Name” and “Cargo”“Role”. “FecIni” “IniDate” column table will be logged at the moment that we insert the value in DB.

Click “Accept” button in popup to create the “Name” inputbox control and repeat the same step for “Cargo” “Role” inputbox control.

 

Controls section now display the 2 input fields that user can add through the page and also there are 3 “Grid_Column” controls. This columns are going to retrieve the readable information from DB. Keep in mind that we created the Stored Procedure for this purpose in previous steps.

...

This button is named as “Agregar”. In the example, everytime that Application User input the “Nombre” “Name” and “Cargo” “Role” inputboxes and then click “Agregar” “Add” button, the new value are going to be added in “Test Empleados” Employees” table.

    

 

How to add Actions in Controls?

 

Wayfast allow us to create a new action at the same time that we create the control. In the “New Control” popup, click “Actions” tab

...

  • FORM is used in Wayfast as unique execution in the whole page. 

  • LIST is an action that can be executed as many times that it’s requested. Mostly this is needed when the page has multiple registries in grid views.

Search the “SP_AgregarEmpleado” AddEmployee” Stored Procedure created. Add “&InpNombre” InpName” and “&InpCargo” InpRole” parameters that are connected to the Column’s table “Nombre” “Name” and “Cargo”“Role”. In Wayfast, we associate the entry parameters using an “&” sign instead “@” sign.   

...

After clicking “Accept” button, Controls and Actions are updated in Page’s detail. 

How to modify the execution in Dataset now that contains an Action associated?

It’s important to verify how the Dataset execution is going to work with Controls and Actions setup.

...

Click “Accept” to save the changes.

 

How the Application works after all the definitions?

Now that the page is setup with Dataset, Controls and Actions, we can verify that the interaction is working as expected. Wayfast allow us to make a preview by click on “Preview” button at the top right corner

...

Layout is displayed on screen with the input fields created and the button to add the new values in “Test Empleado” Employee” table on DB.

 Notice that the entry is displayed on screen after clicking “Agregar” “Add” button. This is possible due to the “Control Run” setting that was added in Dataset to post the information written in DB. This setting make a postback post-back that execute again the dataset to retrieve the new entry.

Recap

In the first part, we learnt about how to Pages interact with DB by creating Datasets. Then we made a first approach using SQL to create an easy Stored Procedure that was linked to Dataset. In the second part, we explained how the Controls under pages can display in many different ways the information available on DB, assigning the place and source. In the next tutorial, we will learn how to connect the Controls with Actions that user will have in pages to interact with the Application.