This function allows, from a formula, to obtain a text string using the data of one or several documents of any Docuo category. The specified category does not need to be related to the one contained in the formula.

The categoryAgg function is only available in Docuo Enterprise version.

For example, if you have a category of countries (PAI – Country) and you want to list them from any formula, you will have to use this function:

Document.categoryAgg(Category, Fields, Separator, Order, [Condition])

Where:

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

PAI

Fields: is the text string in inverted commas with the labels of the fields we want to extract from each document. They can be combined with fixed text as shown in the example:

'Name: <@PAI:Properties:Name>, Continent: <@PAI:Data:Continent>, Residents: <@PAI:Data:Residents>'

Separator: is a text string enclosed in inverted commas that separates the data in each document. It can include either \n for line breaks or \t for tabs. For example:

'\n'

Order: is a sorting text string. It indicates on which field or fields we want to sort the results. The syntax must include the name of one or more fields separated by commas. After each of them we can specify the ASC or DESC clause to indicate the order. For example:

'<@PAI:Data:Residents> DESC, <@PAI:Properties:Name> ASC'

Condition: is an optional parameter with a T-SQL condition text string of the same type as used in drop-down lists. It allows us to filter the results of the aggregate. For example, to filter European or Asian Countries:

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

Finally, the final formula would be as follows:

Document.categoryAgg(PRV, 'Name: <@PAI:Properties:Name>, Continent: <@PAI:Data:Continent>, Residents: <@PAI:Data:Residents>', '\n', '<@PAI:Data:Residents> DESC, <@PAI:Properties:Name> ASC', "<@PAI:Data:Continent> = 'Europe' OR <@PAI:Data:Continent> = 'Asia'")

You would get a text string with the specified data for countries that are either Asian or European, sorted by population in descending order and separated by a line break:

Name: China, Continent: Asia, Residents: 1.403.500.365
Name: India, Continent: Asia, Residents: 1.398.496.000
Name: Indonesia, Continent: Asia, Residents: 269.856.000
Name: Pakistan, Continent: Asia, Residents: 222.017.000
Name: Bangladesh, Continent: Asia, Residents: 179.904.000
Name: Russia, Continent: Europe, Residents: 146.710.000
Name: Japon, Continent: Asia, Residents: 126.127.000
...
 

Take the free trial

Use it yourself free for 30 days (no credit card needed)

Free Trial