DWVLookup in DriveWorks Pro Administrator, returns a value from a table corresponding to a match found in the specified column.
Syntax
DWVLOOKUP( [ Value], [Table Name], [Lookup Column], [Result Column Index], [MatchType] )
[Value] is the value to be found.
[Table Name] is the table within which the value is to be found.
[Lookup Column] is the number of the column containing the data to be searched for.
[Result Column Index] is the number of the column containing the data to be returned.
[MatchType] defines whether the match has to be exact or the nearest found.
The video below shows an example of the DWVLookup function in action.
Examples
Rule |
Meaning |
---|---|
DWVLOOKUP(CarColourComboBoxReturn, Vehicles, 3, 2, FALSE) | The function looks in the Vehicles table for a match, in the third column of the table, to the value returned from the CarColourComboBox. If a match is found, the function then looks across to the second column and returns the value in the same row as the match found. The user has also specified that the match needs to be exact (denoted by the FALSE term). In this case, the Car Colour selected in the combo box is “Blue”, so the function returns “Golf”. |
Example Outcomes
Lookup |
In |
LookupColumn |
ReturnColumn |
MatchType |
Outcome |
---|---|---|---|---|---|
“Blue” | Vehicles | 3 | 2 | False (Exact) | “Golf” |
“White” | Vehicles | 3 | 1 | False (Exact) | “Renault” |
26 | People | 3 | 2 | True (Nearest) | “Dave Sharp” |
42 | People | 3 | 4 | False (Exact) | Female |
Example Data
Vehicles Table
Make |
Model |
Colour |
---|---|---|
Volkswagen | Golf | Blue |
Ford | Escort | Red |
Renault | Kangoo | White |
Mazda | 2 | Black |
People Table
Member ID |
Name |
Age |
Gender |
---|---|---|---|
42 | Dave Sharp | 25 | Male |
44 | Joe Bloggs | 37 | Male |
96 | Sandra Shield | 42 | Female |
107 | Thomas Knight | 21 | Male |
251 | Isabelle Jones | 56 | Female |