AFTER
Takes the child records for each parent and sorts them by the field specified in the field_name parameter. Then checks the source query against the target query and returns True if any of the records in the source query came after those in the target query, otherwise the function returns False. If the optional filter query is supplied then the records in the source and target query are restricted so that only records that match the criteria are evaluated.
AFTER ( <field_name>, <source_query>, <target_query> [, <filter_query>] )
-
field_name: The field on which to sort records by
-
source_query: A query string that represents the set of records to check.
-
target_query: A query string that represents the set of records to check.
-
filter_query: A query string so that you can restrict the records being checked.
Example: create a field on the CUSTOMER table that flags customers who have bought a product with product code R after (sorted on purchase date) they bought a product with product code B where the product value was greater then 25.
AFTER( [PRODUCT.PRODUCT_PURCHASE_DATE], [PRODUCT.PRODUCT_CODE] = "R", [PRODUCT.PRODUCT_CODE] = "B",[PRODUCT.PRODUCT_VALUE] >25)