Creating a Style
To create a new style:
- Click New to clear the form.
- In the Code field, enter a string, with a maximum of 15 characters, to identify the style in the database.
- From the Key to Retrieve drop-down menu, select the reference ID to retrieve in the search.
- In the English Short Description field (or the Short Description field of your first language), enter a description to a maximum of 25 characters.
- In the English Long Description field, enter a description to a maximum of 50 characters.
- Repeat steps 4 and 5 for the French, Spanish (or your second language) fields.
- Select the objects to link to the style, using the Add button.
- Define the order of the Object Sequence, using the Up and Down buttons.
- Compose your query in the Query edit box, or copy and paste it from another application.
- Click Add, under the Available Styles list box to add it to the list.
Modifying a Style
To modify an existing style:
- Highlight the style in the Available Styles list box.
- Make your change on the form.
- Click Save to resave the style with the new parameters that have been search.
Deleting a Style
To delete a style:
- Highlight the object in the Available Styles list box.
- Click Delete.
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 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.
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)…
- In GNA select Setup > Search Configuration > Manage Styles.
- To start a new entry, click Clear All Entries.
- In the Code field, enter pcParcelID2.
- In the English Short and Long Description fields, enter By Parcel ID2.
- Enter Par ID de la Properiete in the French Short and Long Description fields.
- In the Linked Objects (by sequence) field, click Add (1); this will display an Available Objects screen (2).
- In the Available Objects screen, select the parcel ID object that was created in the Create a Parcel ID Object example , Parcel ID Seg. Click Add.
- You will be returned to the Search Styles Management form.
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
paste it into the Query parameter.
Type in the query as follows:
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=
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.
To specify the Parcel ID object in your query…
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.
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. |
For a list of SQL query rules that should be followed in GNA, see SQL Syntax Rules for GNA.
Viewing Results in MS Govern
When the style has been saved, it can be seen in 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.
3. Click the Predefined Searches tab to display the Search form.
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
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”.
Change Column Titles with an Alias
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.
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…
SELECT PC_PARCEL.P_ID,
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
…can be rewritten with aliases using the AS statement…
SELECT PC_PARCEL.P_ID AS ‘Parcel No.’,
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_0
Column Titles That Should Not Be Used
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.
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
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.
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
To make alias entries in the Resource File…
- In GNA, select Setups /Editors > Editors > Resource File Editor.
- In the Resource File Editor select File > Open…
- Navigate to the root directory of your deployment; in the ResourceFiles folder, select the GovernNet.en.resources resource file.
| NOTE: Editing Resource files should only be done by qualified individuals with Administrator privileges. |
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
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
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.
NOTE: The COL and _CH padding are mandatory for your entry to be recognized by the system.
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.
To add an alias to the function…
- To add an alias to the WEB_CO_SEARCHPANEL function, on the left hand side, right click on the function name; select Add Entry… from the floating menu.
- In the Resource File Text Editor, enter the column name into the Label parameters.
- Enter the alias column name in the English String and other language parameters.
- Click OK to accept the change.
When entered, this aliased column title will be displayed online.
| 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 Objects
Dynamic Search Styles
Dynamic Search Groups