The functions described in following sections provide efficient lookup features to retrieve selected information from other tables (referred to as lookup tables) which will then be written into the target table. All function varieties follow the same basic lookup principle in similar ways: For the target table, one or more input columns need to be specified where the corresponding contents in every row will be compared with the search columns in the lookup table. When a matching row has been found, then the corresponding contents in the output columns in the lookup table will be transferred to the destination columns in the target table. B4P provides following function families:
table lookup | Information found in the lookup table will be retrieved and written into the target table. |
table integrate | Information found in the lookup table will be combined with the existing contents in the target table, using underlying rules of the specified table integration operation identifiers. Example: Retrieved numeric scores can be added to the existing value in the destination colum, instead of simply overwriting them. |
table expand | Works similar to table integrate, but if two or more matches are identified in the lookup table, then additional rows will be inserted in the target table, original contents repeated downwards in the target table, and then updated with the contents retrieved from the lookup table. |
table expand fast | A variant where the additional rows are added to the end of the table in order to avoid wasting time shifting other rows downward |
table digest | Works similar like table integrate where all matches instead of just the first one in the lookup table are integrated into the target table. |
These functions come with following variants where these variants are added to the function names above:
... top down ... | The table will always be searched from top to bottom. No automatic indexing made for large lookup tables. Beneficial for lookup tables where the first rew rows at the top would be found most frequently in order to save search time. |
... fast ... | The row number of the last match in the lookup table will be memorized. The search continues there when the search begins with the next row in the target table. Very useful if both target table and lookup table are already in an alphabetic order and this can accelerate the lookup performance significantly. Not applicable for table digest(). |
... once ... | Every row in the lookup table can be retrieved only once. For the next search, the next match below that row would apply, as long there are matches. |
... smart ... | The lookup table contains smart patterns supporting comparison operators, wildcareds, multiple values and ranges. In addition, B4P expressions returning boolean results can be specified. |
... smart once ... | Combination of both once and smart. |
... with rules ... | An opposite variant of smart: The matching patterns and possibly B4P expressions are specified in the target table and the lookup table contains the contents compared with and returned where matches are identified. |
... with rules once ... | Combination of both once and smarty/b>. |
Finally, the function names can be rounded up with the ... ignore case suffix which makes all comparisons case insensitive. Only exception: B4P expressions
returning boolean results are not affected by this rule, but the ignore-case ruling can be included in the expression, for example using the '+' comparison options.