Search Grid Rules

Rules Related to Search Grid

1. FillData


Function Syntax:

FillData(controlName)

This rule is used to fill the search grid. After the Search configuration one must call FillData function to fill the search control.

Rule eg:

Img1
      Figure 5-1

 

  • Srch- is a variable.
  • BtnSearch-A button control which is used as a trigger.
  • Search1- Search control.

2. GridGetvalue :

To get value from a particular column of the search control.

3. GridSetValue:

To set value to a column.

5.2 And 5.3 Rule Illustration: Calculate net amount of products in a search grid

  • Configure a search.
  • The columns are added as shown in the below pic:

Img2
   Figure 5-2

  • Create a rule to fill the search control.

Img3
* BtnTotalPrice- is a button control used as trigger for search.

Net Amount (marked in red box) is a composite column. We want to calculate Net amount of each and every product in the search grid.

  NetAmount= (UnitPrice-Discount)*Quantity

  • According to this equation first we have to get “Unit Price, Discount and Quantity”. For this we are using “GridGetValue” function

  Rule:
Img4
Figure 5-3

 

Step1: GridGetValue function should be initialized only if there is at least one row in the search grid. So first we have to check RowIndex of the search control is null or not. This is shown in the first decision box.

Img5
  Figure 5-4

  • If RowIndex is not null, get all the required values (shown in action boxes) and assigned those values to variables.
    • *Price, Discount, Qnty and TotalPrice – are variables.
  • Now we have TotalPrice of a product. We have to set this value into “NetAmount” column of the search grid. For this we are using GridSetvalue

Img6
  Figure 5-5

Note: Take the column index from the search configuration not from the preview page.

I used the search control itself as trigger for this rule so that Netamount will be calculated once the search is completed.

4. GridSetRowStyle

This function helps to set style to rows in a search grid. Currently we can set two style properties, “BGColor and FontColor”.
Check figure 5-6 which shows a search grid without any row style.

Img7
  Figure 5-6

I am going to highlight all the rows in which the “gender= male” into red color and font color of all other rows  Into blue color.

Rule:
Img8
Figure 5-7

Rule explanation:

  • Use “GridGetvalue” function to get the value from the 4th column of the search grid.
    • *Gender- is a variable.
  • In the next decision box we checked whether “gender=male”, if so set the row background into red color.
    • Function Syntax Explanation:
    • GridSetRowstyle(search1,BGColor,Search1.RowIndex,”Red”)
      • Search1-Control name
      • BGColor-Propertyname
      • RowIndex-RowIndex
      • “Red”- name of color.

If Gender!= male, set font color of those rows into “Blue” color. This is shown in the first action box of the “else” condition decision box.

Preview
Img9
  Figure 5-8

5. GridSetCellStyle

 

This function helps to set style to a particular column.
Check the last action box in Figure 4-7.
Here the second column of the search grid will be in yellow color if the “Gender!= male”.

Function Syntax Explanation:
Img10

  Figure 5-9

Search1- Control Name.
BGColor-Property Name.
Search.1RowIndex- Row Index.
2 – Column Index
Yellow – Value (which color needs to be set).

 

Preview


Img11
  Figure 5-10

6. GridSetColHeader


GridSetColHeader(GridControlName,Column Index,HeaderText)


This function used to set the column headers of a search grid.

Function Syntax Explanation:

GridControlName: Searchgrid/DynamicGrid
Column Index: Column number
1-Header Text: The text which need to be displayed as the column header.

Rule :
Img12

Search1-GridControl
2- Column Index
“Header Changed” -Text which will appear as column header.

Img13
Figure 5-11

 

7. GridSetColVisible


GridSetColVisible(GridControlName,Column Index,Visibile)


GridControlName: Search/Dynamic grid
Column Index: column number
Visible: True/fasle.
If the value is “True” then the column will be displayed. If the value is “false” that column will not be displayed.

Refer Figure 5‑12. I want a search grid with all the columns in Figure 5‑13 except “CUstID” column. So I am using “GridSetColVisible” function.

Rule:
Img14

  • Search1-GridControlName
  • 1- Column Index
  • false – value for “visible” argument.

Preview
Img15
Figure 5-14

8. Rules Related to Details View Toolbar


1.1  GridRowDetailsGetValue (GridControl Name,RowIndex,ControlNamewithProperty)


To get the value from a details view control.

1.2  GridRowDetailsSetValue(GridControlName,RowIndex, ControlNamewithProperty,Value)


To set value to a detailview control.

  6.1 Syntax Explanation:

  • GridControlName: Name of the search grid.
  • RowIndex: Row number.
  • ControlNamewithProperty: Detailview control and the property which we need to get from that control.

Rule:
Img16

Rule explanation:

In this rule, getting the value of the row detail control (TxtFname) and assigns that value to TextBox10.

  • TextBox10- A TextBox.
  • Search1-GridControlName.
  • 3-RowIndex.
  • Value- ControlNamewithProperty.

Result
Img17

Figure 6-1

 

Rule
Img18

  • Search1-Gridcontrol.
  • 1-RowIndex.
  • Style.FontColor-Deatilviewcontrolwith property.
  • Green-Value to be set.

Result
Img19

Using RowDetails Property in a Search Grid

This blog will explain you on the RowDetails property in search grid.

RowDetails Property

  • To get the “Row Details” in search grid, select either “On Select “ or “Always’ option from the Row Details drop down.

g1Figure 31

  • A new tab named “Row Detail” will be displayed next to the general tab of the search control.

g1 Figure 32

  • Click on the “Row Detail” tab. A sub form will be displayed inside the search grid as shown in the figure 33.

g1Figure 33

  • Click on the “ToolBox”. “Details View Tools” displays

g1Figure 34

Hyperlink, Label and TextBox controls are available. Drag the desired control into the detailed pane.  I have added the row details as shown in the below picture. Background color of these controls has been changed for better understanding.

g1

  • Next step is to bind these controls to the desired columns.
  • For search grid, we have 8 data types (String, Integer, Decimal, Date, DateTime, Image, ImageURL and FileDownload). All the link data types (ImageURL and File Download) must be bind to the “Hyperlink” control in the Details View Tool bar. All other data types can be bind to either TextBox or Label controls.
  • After configure a search (Refer Section 4 for how to configure a search), map the row details controls with the desired columns. Click on the row detail control which we drag into the form in the above step. Property section will be opened. Select the column which we want to map with the details view control, from the “Data Binding” dropdownbox as shown in Figure 3-5.

g1 Figure 35

Preview for RowDetails=On Select

By default the first row will be shown in detail mode. When click on any other row that will be shown in detail mode.

g1

For RowDetails=Always

All the rows will be displayed in detail mode.

 

Get Started with our Appforms Development Services