Dynamic Search Styles
Overview
Use the Dynamic Search Style management form to create search styles. A Search Style displays the Objects that appear on the Search page, these include search criteria and labels, and when initiated, launches an SQL query.
The Dynamic Search Style Management tool consists of two parts:
- Available Styles (by Sequence): The Available Styles list box displays the existing search queries or Styles. To view the details on a style, highlight it in the list.
- Styles: The Styles tab displays details on the selected object. Details include a list of the linked objects and the SQL query.
Linked Objects
The linked objects are listed in the order that they appear on the Web page.
To modify an Object Sequence:
Linked Objects: Linked Objects appear on the Web page in the order they are listed in the sequence.
- Click Up to move the object towards the top of the list; so that it is performed nearer to the beginning of the sequence.
- To move the object towards the end of the list, click Down. When moved down it is performed closer to the end of the sequence.
- Click Add to open a secondary form where you can select objects to add to the sequence.
- Highlight the object or objects that you want to add. Then, click Add on the secondary form.
- To remove an object from an object sequence, highlight the object, in the Linked Objects list box and click Remove
Read More... To create a new style: To modify an existing style: To delete a style: In the following example we will create a query that will perform a search by Parcel ID (P_ID). This query will use an object that was created in an earlier example in this document. See Create a Parcel ID Object. At this stage you are ready to enter the query that was designed earlier. If you find the Query field space too restrictive when typing, one method you can use is to create the query in a text editor. After typing in the statements, copy and SELECT PC_PARCEL.P_ID, PC_PARCEL.TAX_MAP, PC_PARCEL.SUBD, When we compare the above statement to the one that was create earlier, the object called pcParcelID2 has been left out. The reason for this is that when we want to include objects that are in the Govern system, the Search Styles Management form can take care of the entry and append any required special characters that the system may require. 9. Place your cursor immediately after the “=” sign (1) in your query statement, under the Linked Objects (by sequence) field (2), double-click on the Parcel ID Seg. For a list of SQL query rules that should be followed in GNA, see SQL Syntax Rules for GNA. When the style has been saved, it can be seen in Govern. 3. Click the Predefined Searches tab to display the Search form. As seen above (B), when results are displayed, the titles used for the requested columns are those of the database tables. When keeping an enduser in mind, column names used in the table, although acceptable for a database programmer, usually do not offer too much value to an end-user. For example, a column titled ”P_ID” is more understandable if it were called “Parcel ID”, or “SUBD” if it were called “Subdivision”. To customize the display of the column titles in our query results,’ display titles that are descriptive to the user will involve the use of an Alias. The syntax for using an alias in our SELECT statement is as follows… SELECT PC_PARCEL.P_ID AS ‘Parcel ID’ The SELECT statement is used to indicate the columns that are to be displayed in the query results. AS is used to designate the alias name to be used for the resulting column title. SELECT PC_PARCEL.P_ID, …can be rewritten with aliases using the AS statement… SELECT PC_PARCEL.P_ID AS ‘Parcel No.’, It should be noted that when you select an alias name for your column titles, it should not be the same as one of Govern’s Keywords. The process to create queries that are to be accessible on the web is the same as creating Dynamic Search queries. The major difference is in the location where the aliases are to be defined. To make alias entries in the Resource File… In the Resource File, the function that you will be looking for is called WEB_CO_SEARCHPANEL. This function is located in the Web (WB) module of the Resource File. 4. In the column on the left hand side; click on the “+” beside WB to expand it and view all the functions within the module, or perform a search for the string with the find menu option. See When the keys for the aliases are entered into the function, they must be named in a format that the system is expecting. The format to be used is as follows: COLmyHEADING_CH Where myHEADING is the title of the column in the table. The entry is padded with “COL” on the left hand side and “_CH” on the right hand side. For example if we wanted to enter a column title called SUBD, the entry would be COLSUBD_CH the alias title to be used will be Division. To make your entry you will need to use the Resource File Text Editor. In the Resource File Text Editor, the Label parameter will contain the “padded” key entry, and the alias that will be used is entered in the text section of the form. When entered, this aliased column title will be displayed online. Dynamic Search ObjectsCreating a Style
Modifying a Style
Deleting a Style
Create a Dynamic Search Style Query
NOTE: A basic understanding of Structured Query Language (SQL) queries is a prerequisite for this example.
Design the Query
In the database, the table that is being searched is called PC_PARCEL. In addition we will also retrieve information from other columns in that table. The additional information that would be of value would be the Tax Map Number, Subdivision, the Effective Year, and Inactive Year.
A basic SQL query would consist of three parts, a SELECT statement, a FROM statement, and a WHERE clause.
The following is our example statement…
SELECT PC_PARCEL.P_ID, PC_PARCEL.TAX_MAP, PC_PARCEL.SUBD,
PC_PARCEL.LOT, PC_PARCEL.EFFECTIVE_YEAR,
PC_PARCEL.INACTIVE_YEAR FROM PC_PARCEL WHERE
PC_PARCEL.P_ID=pcparcelidseg
The SELECT statement indicates the columns that are to be displayed in the
Results pane.
The FROM statement will indicate the table that the columns are to be selected from.
The WHERE clause is used as a filter for the results, i.e. we say “WHERE” PC_PARCEL.P_ID is equal “=” to the pcParcelID2 object.
The pcParcelID2 object is a search object that was created in the Search Objects Management form. See Create a Parcel ID Object.
Creating the Query in GNA
To build the Query in Govern New Administration (GNA)…
paste it into the Query parameter.
Type in the query as follows:
PC_PARCEL.LOT, PC_PARCEL.EFFECTIVE_YEAR,
PC_PARCEL.INACTIVE_YEAR FROM PC_PARCEL WHERE
PC_PARCEL.P_ID=
To specify the Parcel ID object in your query…
10. The object name is addded to the query; click Save.
NOTE: In the above final statement you will note that there is no space before or after the “=” sign. This is one of thesyntax rules that should be followed when creating queries.
Viewing Results in MS Govern
To view the Search Style in MSGovern.NET…
1. Open a Profile in MSGovern.NET.
2. From the Ribbon, select Views tab; Predefined Searches > Search Styles > By Parcel ID 2.
4. The search form will display your object (A) and when you perform a search, the columns that you had requested in your query will be displayed.Query Result Column Titles
Change Column Titles with an Alias
NOTE: When using AS ensure that the alias name is surrounded by an opening and closing single quote, e.g. ‘Alias_Name’.
If one were to modify the following Dynamic Search query for a search by Inspector, the following statement…
PC_PARCEL.TAX_MAP,
PM_INSPECTIONS.INSPECTION_DATE,
PM_INSPECTIONS.STATUS,
NA_NAMES.NAME_INDEX
FROM PC_PARCEL,
PC_LK_PARCEL_INSP,
PM_INSPECTIONS,
NA_NAMES
WHERE PC_PARCEL.P_ID=PC_LK_PARCEL_INSP.P_ID
AND PC_LK_PARCEL_INSP.IN_ID=PM_INSPECTIONS.IN_ID
AND PC_LK_PARCEL_INSP.MASTER_DEPT=PC_LK_PARCEL_INSP.DEPT
AND PC_LK_PARCEL_INSP.MASTER_DEPT=department
AND PM_INSPECTIONS.NA_ID=NA_NAMES.NA_ID
AND NA_NAMES.NAME_INDEX LIKE @ininspector_0
PC_PARCEL.TAX_MAP AS ‘Tax Map No.’,
PM_INSPECTIONS.INSPECTION_DATE AS ‘Inspection Date’,
PM_INSPECTIONS.STATUS,
NA_NAMES.NAME_INDEX AS ‘Inspector Name’
FROM PC_PARCEL,
PC_LK_PARCEL_INSP,
PM_INSPECTIONS,
NA_NAMES
WHERE PC_PARCEL.P_ID=PC_LK_PARCEL_INSP.P_ID
AND PC_LK_PARCEL_INSP.IN_ID=PM_INSPECTIONS.IN_ID
AND PC_LK_PARCEL_INSP.MASTER_DEPT=PC_LK_PARCEL_INSP.DEPT
AND PC_LK_PARCEL_INSP.MASTER_DEPT=department
AND PM_INSPECTIONS.NA_ID=NA_NAMES.NA_ID
AND NA_NAMES.NAME_INDEX LIKE @ininspector_0Column Titles That Should Not Be Used
For example in the above, the obvious column title of ‘Parcel ID’ was not used, instead ‘Parcel No.’ was used. The reason for the change is that ‘Parcel ID’ is a system reserved keyword.
Refer to Govern for .NET Keywords for a list of KEYWORDS THAT SHOULD NOT be used.
To use the above modified query in Govern.NET, in GNA either create a new query or for this example, modify an existing query.
1. Select Setup > Dynamic Search Configuration > Dynamic Search Styles…
2. In the Web Search Styles Management form, select an existing style, or create a new style. See Creating a Dynamic Search Style Query for details.
3. Modify the query statements in the Query parameter.
4. Click Save to save the modifications.
In Govern.NET…
5. Perform an Inspector search in Govern.NET; specify By Inspector (1).
6. Enter a required name in the parameter (2) or directly click Search for Results (3).
7. You will note that the column names are using the specified alias titles.
NOTE: Alias names are not case sensitive, titles are presented in capital letters
Dynamic Search Queries on the Web
For Web searches column titles are defined in the resource file. This allows for the re-use of the column titles in other searches. For example if the P_ID is defined as Parcel No., it will always display as Parcel No. whenever it is used.
This approach centralizes the definitions and minimizes the chances of error when multiple aliases have to be defined in each search style.
To make the entries into the resource file, you will need to use the Govern Resource Editor. The Resource Editor is included in GNA. Under Setups / Editors > Editors > Resource File Editor. See Resource File Editor for details about using the Resource File Editor.
NOTE: The Resource File is located in the root directory of the deployment folder and should only be edited by a system administrator.
Modifying Web Search Result Column Headings
NOTE: Editing Resource files should only be done by qualified individuals with Administrator privileges.
5. When the WEB_CO_SEARCHPANEL function has been located, click to select it; the keys will be displayed in the pane on the right hand side.Format for Entering the Alias Key
NOTE: The COL and _CH padding are mandatory for your entry to be recognized by the system.
To add an alias to the function…
NOTE: Unlike the the column titles in Govern, titles will be displayed as they are entered, i.e. in both upper and lower cases.
NOTE: All column header aliases will apply to all search style queries containing the same field name or alias name. In addition, search style queries using aliases are required to use the alias name instead of the field name in the table.
See Also
Dynamic Search Styles
Dynamic Search Groups
103-ED-015