Versions Compared

Key

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

Overview

Wayfast Actions allow executing process or communicating with external systems incluiding databases, APIs or executing DLL methods. In this lesson we will review how to create an action to save data in a table with a Stored Procedure.

Step 1: Create a Table

Open SQL Server Management Studio and run the following script:

...

Let’s go back to Wayfast Editor and Update Wayfast DB Model.

Click on “End Task” button related next to Project’s our active requirement.

...

This step is only needed for synchronization of the new Table and Stored Procedure generated in DB.

...

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 Controls to interact with Application?

 Preconditions

...

Step 2: Setup the page

Before creating an action we need to create a page with the following controls:

  1. Inputbox: This control will allow us to insert data into our database

  2. Button: This control will trigger the insert and it should be connected to the Action that we are going to create

  3. Grid_column: This control will display the values that we have stored into our database

Let’s navigate to Pages and open a specific Page’s Detail form. Focus on Controls section. Then select “Inputbox” control and click on “New” buttoncreate a page called “HR_Candidates” with the following details:

...

Edit the page and add four “Inputbox” controls: FirstName, LastName, Email and Age.

Now let’s add a button to save this fields and a grid with five columns to show saved values including autogenerated IDs.

Image Modified

A popup will be displayed to fill the information related to new control. Complete the “Field” with the fieldname that we are going to identify the control in our page.

...

 Turn to Layout tab and establish the order to display this control. We are going to place it next to the inputboxes. Click on “Submit” button

...

How to add Actions in Controls?

Wayfast allow us to create a new action at the same time that we create the control. Now that we have “Create” button, let’s edit the this control and create a new action. In the “Edit Control” popup, click on “Actions” tab

...

After completing the required fields, clicks on “Submit” button, the new action is linked to the “Button” control.

...

How to update Database with an Action?

One of the common scenarios in the interaction between dataset and actions is the one where the database is updated with new input values but it's not reflected on screen at the moment that was triggered. Let’s analyze what we need to check and how the new action is connected to the Dataset.

...

Let’s check the results in the example.

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

...

Info

In case we want to verify that the functionality is working as expected in database, open the SQL Server Manager and check if the table has the new input values inserted through the app.

Recap

In the first part, we revised the preconditions to create pages with a basic structure (dataset and controls) and then we learnt how to create new actions that can be related to these Controls previously added. In the second part, we verified how the interaction is executed in the application and how this can be edited to adjust the interaction regarding what we display and what we insert in the database.