NTH_BEFORE

Works at the many end of a one-to-many link and flags child records that are before records that meet the criteria given in the source query. The records are checked in natural database order.

NTH_BEFORE ( <source_query>, <link_table>, <N>, [, <All> [, <filter_query>] ] )
  • source_query: A query string that represents the set of records to check.

  • link_table: The name of the table at the one end.

  • N: The index value to be used. A value of 1 indicates that the first value (after a record meeting the source_query criteria) will be flagged; a value of 2 indicates that the second value (after a record meeting the source_query criteria) will be flagged and so on.

  • All: 1: Flag all records up to and including the Nth record. 0 just flag Nth record. 0 is default.

  • filter_query: A query string representing the domain of records to include.

Example: Create a field on the PRODUCT table that flags all records up to and including the 3rd record before a product of type B was purchased.

NTH_BEFORE([PRODUCT.PRODUCT_CODE] = "G",CUSTOMER,3,1 )