Lookups |
Top Previous Next |
Lookup queries are used by Crash Magic to change database codes to readable values in filters, ClickOn reports and other areas of the program. For example a numeric values of 1,2 or 3 can be stored to represent a lighting condition for each collision record. Crash Magic can use a lookup query to display what the values represent (Daylight, Dawn\Dusk or Dark) depending on the data .
Lookup query names should reflect what the query is looking up.
The following are the fields required for a lookup query:
DBFIELD: This is the name of the field that needs to be looked up. This value must match the Lookup value for the field to be looked up for the study and ClickOn queries.
DBVALUE: This field contains the values that will be looked up.
DBLOOKUP: This field contains the information displayed to the Crash Magic user.
DBTABLE: Reserved for future use. This should be blank ('').
DBNAME: Reserved for future use. This should be blank ('').
In the example query below the TRAFFIC_LOOKUPS table contains lookups for all of the database fields. The table has three columns LU_CODE, LU_VALUE and LU_DESC.
( SELECT
TRAFFIC_LOOKUPS.LU_CODE AS DBFIELD, TRAFFIC_LOOKUPS.LU_VALUE AS DBVALUE, TRAFFIC_LOOKUPS.LU_DESC AS DBLOOKUP, '' AS DBNAME, '' AS DBTABLE
FROM TRAFFIC.TRAFFIC_LOOKUPS
) |