Collecting Lookup Feedback Information

Prev Next

Introduction

Most table lookup functions such as table lookup(), table integrate(), etc. provide optional feedback information how the lookup process has proceeded. The feedback mechanism helps to answer following questions:

  • Which of the rows in the lookup table have actually been accessed and how frequently?
  • Which rows in the target table underwent a successful lookup or even multiple lookups (when using table digest())
  • Did the lookup result to contents changed in the target table, and which ones?
  • Does the lookup table contain rows which are lookedup but the contents are actually the same as in the target table, so the rows could possible be removed. Very useful when maintinaing temporary correction tables until the corrections are no longer needed.

The feedback information mechanism can be specified in the last funtion parameter where up to six parameters can be provided. The last parameter may be of following types:

  • Numeral or string: Specifies one column being the first parameter as described below.
  • Empty set: Zero parameters are assumed, so no table feedback information will be provided.
  • Set containing 1 - 4 elements which correspond to providing 4 additional parameters. 5 or more elements flag error messages.
  • Empty sets are allowed to skip parameters, e.g. { {}, {}, Changes } specifies the 3rd parameter only, skipping the first two.

All non-existing columns will be created and added automatically to the right hand side of the tables.

Nr. What is specified Purpose
1 Lookup table column Counts the number of lookups made from.
2 Target table column Counts the number of lookups made to. Typically counted only once unless table integrate() is used.
3 Lookup table column Counts the number of lookups made where the contents in the target table has actually changed, i.e. value looked up was equal the to value before.
alt. 3 Lookup table column prefix Specify a column name with '*' inside as softquoted string which is used to insert the output columns into the '*' in the lookup table with the prefix in front in order to count individual changes made.
4 Target table column Like above, but on the target table. Typically counted only once unless table integrate() is used.
alt. 4 Target table column prefix Specify a column name with '*' inside as softquoted string which is used to insert the result columns into the '*' in the target table with the prefix in front in order to count individual changes made.



Note regarding 3rd and 4th parameter: If the specified header name is of type softquoted string and contains an asterisk symbol '*', then the output columns in the lookup table (applicable for the 3rd parameter) or the destination columns in the target table (applicalbe for the 4th parameter) will be inserted into the '*' being the placeholder symbol for the column name. 2nd and further asterisk symbols remain untouched. For example, if 'Count * up' is spedified in the 3rd parameter, and the output headers in the lookup table contain {City, Country}, then 2 additional columns named Count City up and Count Country up will be created if not yet existing.

Note: The asterisk will only work if provided as a softquoted string. 'Count *' is OK, but "Count *" will be interpreted as a plain string, looking for or creating one column literally containing Count *.

Note: The prefix will only work if the headers of the output resp. destination columns are not blank and unique. Otherwise, the column created will be overwritten, i.e. incremented multiple times.

If the columns are already existing, along with numbers inside, then the existing numbers will be incremented (adding 1). If the contents are blank or non-numeric, then counting begins with 1.

This new feature is backward compatable to earlier B4P Versions (up to V12.0) where only a modification counter can be specified in the lookup table. It corresponds to the 1st function parameter.