LookUpValue()
Summary
Finds a value in a view field and returns the values in the corresponding fields of your choice, with the option to interpolate both the lookup and returned values when there is not an exact match.
Changes
Added in version 2022.
Syntax
result = LookUpValue(string view_set, array options)
| Argument | Contents |
|---|---|
| view_set | The view and set to be searched |
| Option | Type | Contents |
|---|---|---|
| ReturnFields | Array | The fields to be returned |
| Search | Array | A two-element array. The first element is the name of the field to be searched, the second element is the value to be searched for |
| Interpolate | Boolean | "True" or "False" to allow interpolation if an exact match is not found |
Returns
An array, with one element for each field in the ReturnFields option.
Error Codes
| Error Type | Meaning |
|---|---|
| Error | The search view was not found. The options array is invalid. |
Example
folder = RunMacro("G30 Tutorial Folder")
table_file = folder + "MANH_ZIP.bin"
lookup_view = OpenTable("zips", "FFB", {table_file,},)
opts = {ReturnFields: { "Population", "Black", "White"}, Search: {"ZIP", 10028}, "Interpolate": 0}
ret = LookupValue(lookup_view+ "|", opts)
CloseView(lookup_view)
ShowArray(ret)
>See Also
| Function | Summary |
|---|---|
| LocateNearestRecord() | Finds the map feature nearest a point location |
| SelectNearestFeatures() | Selects a feature in the current layer nearest to each feature in another layer or selection set |
| TagLayer() | Fills a field in a layer with information about the nearest feature in another layer. |