Stored Procedures (Archive)
Overview
In this lesson we will explain how to verify if Stored Procedures are synchronized between our database and Wayfast. This objects are going to be used in the functions like Actions, Dataset and Controls depending on the environment that we are going to develop the application.
How to verify if Stored Procedure is associated to Wayfast?
Stored Procedure: This is an object in database that we can create manually in SQL Server Management Studio. This will allow developers to make inquiries and modify our data given certain procedures.
Click on “Database” icon at the top header.
On Submenu, click on “Stored Procedure” subtab
Grid view is displayed on screen with all the Stored Procedures associated to our Project. You can observed that the “Object Name” will be the Stored Procedure identification and “Database” column will let us know to which database is associated.
How to create a Stored Procedure and synchronize to Wayfast?
Precondition
On Wayfast, make sure that the Project is created and make a Requirement into “Active” status by clicking on “Active Task” button at left side navigation bar.
NOTE: This requirement should always be associated to the database instance from the Project. We will verify later that Wayfast can associate new stored procedures from other databases without using an active requirement.
Click on “Database” icon at the top menu. On Submenu, click on “Stored Procedure” subtab
We can proceed to create a new Stored Procedure in SQL Server
CREATE TABLE Test_Employee(
--Id int identity(1,1) NOT NULL,
Name nvarchar(50) NULL,
Role nvarchar(50) NULL,
Date datetime NULL
)
CREATE PROCEDURE SP_Add_Employee
@Name nvarchar(50) =NULL,
@Role nvarchar(50) =NULL
AS
BEGIN
INSERT Test_Employee(Name,Role,Date)
SELECT @Name,@Role, GETDATE()
END
GO
Once that the new Table and Stored Procedure are created, we can go to Wayfast application.
Click on “End Task” button related to Project’s requirement. This step is only needed for synchronization of the new Table and Stored Procedure generated in database.
A popup is displayed but we don’t need to end the task, just click on “Synchronize” button.
Now we have the new objects available in Wayfast. Notice that the new Stored Procedure is displayed in Grid View.
How to associate a Stored Procedure from a different DB?
Precondition
On Wayfast, make sure that the Project is created and click “End Task” button in case you have an “Active” Requirement at left side navigation bar.
NOTE: We need to make sure that these foreign databases are linked to the Project as well as Instances.
Automatically a new button is enable on screen. Click on “Associate SPs”
A popup is displayed to make the association between the new object. There are 2 options to associate stored procedures into our Project:
Simple
Multiassign
Simple association will bring the Instance and Database to look into the object that we want to connect.
“Multi Assign” checkbox option allow us to select multiple Stored Procedures at the same time from the same Instance and Database.
Checking the checkbox, Wayfast will save the association and list all the selected objects in Stored Procedure’s dashboard.
Recap
In this lesson, we learnt how to associate new Stored Procedures created in SQL to our Project’s database. Also we observed how Wayfast allows us to search other objects that were not generated specifically to the Project that can be available in case we want to use them. These foreign objects can only be associated if Project doesn’t have an active requirement in Wayfast and also if the Instance and Database are related like we explained in previous lessons.