Grid Search
Overview
In this lesson, we will learn how to create a “Grid Search” control under the page form. This option allow us to create a Search field embedded on a column that we can fill with information from our Database through a dataset. This is another easy way to make an association between tables or stored procedures previously generated to print the registers in the project’s application.
How to create a Dataset for “Grid Search” control?
“Grid Search” control has a similar process than other controls that we learnt in previous lessons (e.g. Dynamic Grid), they have to establish a connection with tables or stored procedures based on datasets.
Let’s create a stored procedure in SQL and then create a new dataset in Wayfast.
Open a new query and create a procedure with 4 columns “ID”, “EntryDate”, “Name” and “Role”
Create Procedure [DBO]-[Sp_Dataset1]
AS
BEGIN
SELECT ID,
FecIni AS EntryDate,
Name,
Role
FROM Test_Empleados
END
After execution is done, turn to Wayfast and select any page from the project.
Focus on “Dataset” section and click on “New Dataset” button to create a new one that will contain the information from the Stored Procedure.
Complete the “General” tab with the basic information to identify the dataset. Turn to “Data Binding” tab
Select the “Stored Procedure” type and look for the one created in SQL for this purpose. Once the “Instance” match with the one used in Database to create the procedure, we can establish the proper relationship in Wayfast. Click on “Accept” button to save the changes.
If we edit the dataset and focus on “Columns” tab, we can observe that the same 3 columns are generated automatically in Wayfast at Dataset.
This is the correct way to create a dataset based on Stored Procedures in Wayfast.
How to create a “Grid Search” control in Wayfast?
Now that have all the preconditions generated, we can start the “Grid Search” control creation by selecting the control and clicking on “New” button in the same page that we worked on for Dataset.
A popup is displayed to complete the details on “Grid Search” control. Make sure that the control is properly identified at “General” tab.
Then click on “Data Binding” tab
This is the most important part of the process, first we need to select the same dataset previously created. We can set “AutoSearch = Yes” if we want that the search results will be displayed in the field as soon as it’s getting results. Also on “Type” dropdown, we can choose if this control can be managed from Table, Stored Procedure or Free. This last option offers the possibility to make your own query in “SQL statement” field on the fly, based on the table that you associated in Dataset.
First column on the SQL query should point to the “Grid Search” control name
Select the “Instance” related to the environment that you are developing the app and click on “Accept” button to generate the control.
Now that the “Grid Search” control is created, let’s take a look at the preview to verify that the Layout and the conditions established are correctly working in the environment.
Click on “Preview” button
Inside the grid, we have the column related to the “Grid Search” control and based on the input text, we can find results and select the option to complete the information.
Recap
We used to create “Search” fields separately as control in our pages, this new “Grid Search” control give us the possibility to create a search field inside our grid view as part of a single grid column to fill in the information for each specific row in your application.