1. Home
  2. Administrators
  3. Formulas
  4. JavaScript functions
  5. categoryMax function – Get maximum value of a field

categoryMax function – Get maximum value of a field

This function allows, from a formula, to obtain the maximum value of a field of the documents of any Docuo category. It is not necessary that the category indicated is related to the one that contains the formula.

The categoryMax function is only available in Docuo Enterprise.

For example, if we have a category of countries (PAI – Country) and we want to obtain the maximum number of inhabitants, we must use this function:

Document.categoryMax(Category, Field,[Condición] )

Where:

Category : is the code, the name or the code – name of the category from which we want to extract the data:

'PAI'

Field : is the text string between quotes with the label of the field from which we want to extract the maximum value:

'< @PAI:Data:Population> '

Condition : This is an optional parameter with a T-SQL condition text string of the same type used in dropdown lists. It allows us to filter the results of the aggregate. For example, to filter Countries in Europe:

"< @PAI:Data:Continent> = 'Europe'"

Finally, the final formula would look like:

Document.categoryMax('PAI, '< @PAI:Data:Population> ', "<@PAI:Data:Continent> = 'Europe' ")

We would obtain the data of the number of inhabitants of the country with the largest population in Europe.

Updated on 6 de November de 2023
Was this article helpful?

Related Articles