A CSV-backed lookup table used to resolve output values (for example, a recognition level) from a set of matching input criteria evaluated against a participant or org. Definitions are stored as an XML file (element "lookup-table") alongside a CSV data file in an app's queries folder, and are loaded by QueryService and made available through QueryManager. Each row of the CSV is matched against term and comparison fields, which are evaluated using kcode expressions resolved against the current participant, and the most specific matching row's output fields provide the result. This is used, for example, to derive a recognition level or reward tier from a participant's attributes.

Group: Queries


Properties

PropertyReturnsDescription
fieldsList<LookupTableField>All fields configured for this lookup table, including term, comparison and output fields.
matchFieldsList<MatchLookupTableField>The fields used to match rows against a set of input parameters, populated during init from the fields whose type implements MatchLookupTableField.
nameStringThe name this lookup table is registered under, taken from the data file's name when it was loaded.
outputFieldsList<OutputTableField>The fields whose values are returned as the result of a lookup, populated during init from the fields of type OutputTableField.
rowCountintThe number of data rows loaded from the CSV file backing this lookup table.
titleStringThe display title of this lookup table.

Methods

getName()

Returns: String

The name this lookup table is registered under, taken from the data file's name when it was loaded.

getTitle()

Returns: String

The display title of this lookup table.

getFields()

Returns: List<LookupTableField>

All fields configured for this lookup table, including term, comparison and output fields.

getMatchFields()

Returns: List<MatchLookupTableField>

The fields used to match rows against a set of input parameters, populated during init from the fields whose type implements MatchLookupTableField.

getOutputFields()

Returns: List<OutputTableField>

The fields whose values are returned as the result of a lookup, populated during init from the fields of type OutputTableField.

getRowCount()

Returns: int

The number of data rows loaded from the CSV file backing this lookup table.

findMatching(Map<String,Set<Object>> params)

Returns: List<MatchRow>

Finds all rows whose match fields are satisfied by the given parameters. The index is used to narrow the candidate rows before every match field is checked, including non-indexed ones.

ParameterDescription
paramsthe candidate values for each match field, keyed by field name

findMostSpecific(List<MatchRow> rows)

Returns: MatchRow

Picks the most specific row from a list of matched rows, where specificity is the number of non-blank cell values in the row. Used to prefer a more precisely matched row over a more general one when several rows match.

ParameterDescription
rowsthe candidate matched rows
To get full access to the Kademi Hub existing customers can login here, or new customers can register here.