FLAG
Works at the many end of a one-to-many relationship and flags the first occurrence of a record that meets the criteria supplied in the filter_query argument. In most cases the field_name parameter should be a foreign key.
FLAG ( <field_name> , <link_table> [, <filter_query> ] )
-
field_name: The field to use at the many end.
-
link_table: The name of the table at the one end of the link
-
filter_query: A query string representing the domain of records to include.
Example: Create a field on the PRODUCT table that flags the first purchase for each customer where the product value is more than 50.
FLAG([PRODUCT.CUSTOMER_NUMBER],CUSTOMER , [PRODUCT.PRODUCT_VALUE] > 50)