COUNT_BYINDEX

Returns the number of child records for each parent that match the optional filter criteria, and fall within the specified index. The orderby_field_name allows the child records to be sorted before the records are filtered by the Index parameter.

COUNT_BYINDEX ( <table_name or field_name>, Index [, <orderby field_name>] [, <filter_query>] )
  • table_name or field_name: The name of the table or field to use for counting child records.

  • index: The number of records to use in the calculation.

  • orderby field_name: The field to sort each parents child records by

  • filter_query: A query string restricting the records included in the calculation.

Example: Create a field on the CUSTOMER table to return the number of products that each customer purchased in 1994. (Up to a maximum of 3) Sort the records by purchase price.

COUNT_BYINDEX( PRODUCT,3,[PRODUCT.PRODUCT_VALUE],[PRODUCT.PURCHASE YEAR] = "1994")