This function allows you to compose a field using data from one or more of its “child” documents in one of its detail tabs.

For example, a document of the Country category has several documents of the State category associated to it. And if we want to create a field in Country that lists the data of all its States , we will use the following formula:

Document.detailAgg(List_field, Fields, Separator, Order, [Condition])

Where:

List_field: is the name of the DropdownLlist in the “child” category, where the document of the “parent” category is selected. Its syntax is a tag like this: <@CategoryCode:Group:Field>. For example, in a Country, we can combine the data of its States as follows:

<@PRV:Data:Country>

Fields: is the text string in quotation marks with the field labels that we want to extract from each “child” document. These labels are of the same type as the List_Field. In this case, they can be combined with fixed text as we see in the example:

'State: <@PRV:Properties:Name> Area m2: <@PRV:Data:Area>'

Separator: is a text string enclosed in quotation marks that separates the data in each document. It can include \n for line break or \t for tabs. For example:

'\n'

Order: is a text string for sorting. 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. Behind each of them, we can specify the ASC or DESC clause to indicate the order. For example:

'<@PRV:Properties:Name> ASC, <@PRV:Data:Surface> DESC'

Condition: 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 aggregate results. For example, to filter States starting only with Al:

"<@PRV:Properties:Name> LIKE 'A%l' "

The final formula from a field in the Country category called States starting with Al and its area is the following:

Document.detailAgg(<@PRV:Data:Country>, 'State: <@PRV:Properties:Name>, Area km2: <@PRV:Data:Area>', 'œ', '<@PRV:Properties:Name> ASC', "<@PRV:Properties:Name> LIKE 'Al%' ")

Therefore, for the Country Spain, the field States starting with Al and its surface area would show the following value:

State: Álava, km2 area: 3037
State: Albacete, km2 area: 14926
State: Alicante, km2 area: 5817
State: Almería, km2 area: 8775
 

Take the free trial

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

Free Trial
-->