The nest transformation takes a comma-separated list of one or more nest expressions as parameters. A nest expression is a sequence of set transformations followed by a SimpleIdentifier, called an alias (see [OData-CSDL, section 17.2]). This alias MUST NOT collide with names of properties in the input set or with other aliases introduced in the same nest transformation.
The result set consists of a single entity having one dynamic property per nest expression. The name of the added property is the alias following the as keyword. The value of the property is the result collection of the transformation sequence in the nest expression applied to the input set:
nest( t_1 as cnp_1, ..., t_N as cnp_N ) returns
[{ <cnp_1>: [ <result of t_1 applied to input set> ],
...
<cnp_N>: [ <result of t_N applied to input set> ]
}]
The nest transformation takes a comma-separated list of one or more nest expressions as parameters. A nest expression is a sequence of set transformations followed by a SimpleIdentifier, called an alias (see [OData-CSDL, section 17.2] ). This alias MUST NOT collide with names of properties in the input set or with other aliases introduced in the same nest transformation.
The result set consists of a single entity having one dynamic property per nest expression. The name of the added property is the alias following the as keyword. The value of the property is the result collection of the transformation sequence in the nest expression applied to the input set:
nest( t_1 as cnp_1, ..., t_N as cnp_N ) returns
[{ <cnp_1>: [ <result of t_1 applied to input set> ],
...
<cnp_N>: [ <result of t_N applied to input set> ]
}]
Description
Currently, nest can be used to create an entity with a single containment navigation property holding the result of a transformation sequence:
nest( cnp, t ) returns
[{ <cnp>: [ <result of t applied to input set> ] }]
There are use cases to generalize this and nest the results of multiple transformation sequences at once. Consider, for example, a request to combine the results of two transformations in a single response. Using transformation concat requires an extra computation of a concat index to relate an entity in the result to the corresponding concat argument (see ODATA-1138):
GET ~/Sales?$apply=concat( filter(<complex expression 1>) }}{{/groupby((Customer),aggregate(Amount with sum as Total))/compute(1 as concat_index), filter(<complex expression 2>) /groupby((Customer),aggregate(Amount with sum as Total))/compute(2 as concat_index))
If it makes sense to keep the results of the two transformations separately, they could be retrieved via an extended syntax of the transformation nest:
GET ~/Sales?$apply=nest( filter(<complex expression 1>) /groupby((Customer),aggregate(Amount with sum as Total)) as part_1, filter(<complex expression 2>) /groupby((Customer),aggregate(Amount with sum as Total)) as part_2)
An OData representation of a grid-like result spanned by multiple axes could be achieved by a new transformation {{nest()}} that allows to embed data of grid cells as a nested collection of entities representing grid rows.
Relevant excerpt from section 3 in the referenced document: The {{nest}} transformation has two parameters. The first takes the name of a dynamic containment navigation property, the second is a (chain of) $apply transformations. {{nest( cnp, t )}} applies transformation chain t to the input set and creates a result set containing a single entity that only contains the navigation property {{cnp}}, which in turn holds the result collection of t applied to the input set:
{code:json}
{ <cnp>: [ <result of t applied to input set> ] }
{code}
The nest transformation takes a comma-separated list of one or more nest expressions as parameters. A nest expression is a sequence of set transformations followed by a SimpleIdentifier, called an alias (see [OData-CSDL, section 17.2]). This alias MUST NOT collide with names of properties in the input set or with other aliases introduced in the same nest transformation.
The result set consists of a single entity having one dynamic property per nest expression. The name of the added property is the alias following the as keyword. The value of the property is the result collection of the transformation sequence in the nest expression applied to the input set:
{{nest( t_1 as cnp_1, ..., t_N as cnp_N )}} returns
{code}
{ <cnp_1>: [ <result of t_1 applied to input set> ],
...
<cnp_N>: [ <result of t_N applied to input set> ]
}
{code}
Description
This new feature is motivated by a concrete use case. The current version of the Data Aggregation specification already includes an example for a cross-table and describes how to retrieve its data using transformation groupby in combination with rollup. However, this data is returned as linear collection of entities. For working with data in a grid efficiently, it must be possible to access selected sections of the grid. Details are described in the document “Grid-Like Access to Aggregated Data”, sections 2 and 3: [https://www.oasis-open.org/committees/document.php?document_id=62593&wg_abbrev=odata]
Currently, nest can be used to create an entity with a single containment navigation property holding the result of a transformation sequence:
{{nest( cnp, t )}} returns
{code}
{ <cnp>: [ <result of t applied to input set> ] }{code}
There are use cases to generalize this and nest the results of _multiple_ transformation sequences at once. Consider, for example, a request to combine the results of two transformations in a single response. Using transformation concat requires an extra computation of a concat index to relate an entity in the result to the corresponding concat argument (see ODATA-1138):
{{GET ~/Sales?$apply=concat(}}
{{ filter(<complex expression 1>)}}
{{ }}{{/groupby((Customer),aggregate(Amount with sum as Total))/compute(1 as concat_index),}}
{{ filter(<complex expression 2>)}}
{{ /groupby((Customer),aggregate(Amount with sum as Total))/compute(2 as concat_index))}}
If it makes sense to keep the results of the two transformations separately, they could be retrieved via an extended syntax of the transformation nest:
{{GET ~/Sales?$apply=nest(}}
{{ filter(<complex expression 1>)}}
{{ /groupby((Customer),aggregate(Amount with sum as Total)) as part_1,}}
{{ filter(<complex expression 2>)}}
{{ /groupby((Customer),aggregate(Amount with sum as Total)) as part_2)}}
The nest transformation takes a comma-separated list of one or more nest expressions as parameters. A nest expression is a sequence of set transformations followed by a SimpleIdentifier, called an alias (see [OData-CSDL, section 17.2]). This alias MUST NOT collide with names of properties in the input set or with other aliases introduced in the same nest transformation.
The result set consists of a single entity having one dynamic property per nest expression. The name of the added property is the alias following the as keyword. The value of the property is the result collection of the transformation sequence in the nest expression applied to the input set:
{{nest( t_1 as cnp_1, ..., t_N as cnp_N )}} returns
{code}
{ <cnp_1>: [ <result of t_1 applied to input set> ],
...
<cnp_N>: [ <result of t_N applied to input set> ]
}
{code}
The nest transformation takes a comma-separated list of one or more nest expressions as parameters. A nest expression is a sequence of set transformations followed by a SimpleIdentifier, called an alias (see [OData-CSDL, section 17.2]). This alias MUST NOT collide with names of properties in the input set or with other aliases introduced in the same nest transformation.
The result set consists of a single entity having one dynamic property per nest expression. The name of the added property is the alias following the as keyword. The value of the property is the result collection of the transformation sequence in the nest expression applied to the input set:
{{nest( t_1 as cnp_1, ..., t_N as cnp_N )}} returns
{code:java}
[{ <cnp_1>: [ <result of t_1 applied to input set> ],
...
<cnp_N>: [ <result of t_N applied to input set> ]
}]
{code}
Description
Currently, nest can be used to create an entity with a single containment navigation property holding the result of a transformation sequence:
{{nest( cnp, t )}} returns
{code}
{ <cnp>: [ <result of t applied to input set> ] }{code}
There are use cases to generalize this and nest the results of _multiple_ transformation sequences at once. Consider, for example, a request to combine the results of two transformations in a single response. Using transformation concat requires an extra computation of a concat index to relate an entity in the result to the corresponding concat argument (see ODATA-1138):
{{GET ~/Sales?$apply=concat(}}
{{ filter(<complex expression 1>)}}
{{ }}{{/groupby((Customer),aggregate(Amount with sum as Total))/compute(1 as concat_index),}}
{{ filter(<complex expression 2>)}}
{{ /groupby((Customer),aggregate(Amount with sum as Total))/compute(2 as concat_index))}}
If it makes sense to keep the results of the two transformations separately, they could be retrieved via an extended syntax of the transformation nest:
{{GET ~/Sales?$apply=nest(}}
{{ filter(<complex expression 1>)}}
{{ /groupby((Customer),aggregate(Amount with sum as Total)) as part_1,}}
{{ filter(<complex expression 2>)}}
{{ /groupby((Customer),aggregate(Amount with sum as Total)) as part_2)}}
Currently, nest can be used to create an entity with a single containment navigation property holding the result of a transformation sequence:
{{nest( cnp, t )}} returns
{code:java}
[{ <cnp>: [ <result of t applied to input set> ] }]{code}
There are use cases to generalize this and nest the results of _multiple_ transformation sequences at once. Consider, for example, a request to combine the results of two transformations in a single response. Using transformation concat requires an extra computation of a concat index to relate an entity in the result to the corresponding concat argument (see ODATA-1138):
{{GET ~/Sales?$apply=concat(}}
{{ filter(<complex expression 1>)}}
{{ }}{{/groupby((Customer),aggregate(Amount with sum as Total))/compute(1 as concat_index),}}
{{ filter(<complex expression 2>)}}
{{ /groupby((Customer),aggregate(Amount with sum as Total))/compute(2 as concat_index))}}
If it makes sense to keep the results of the two transformations separately, they could be retrieved via an extended syntax of the transformation nest:
{{GET ~/Sales?$apply=nest(}}
{{ filter(<complex expression 1>)}}
{{ /groupby((Customer),aggregate(Amount with sum as Total)) as part_1,}}
{{ filter(<complex expression 2>)}}
{{ /groupby((Customer),aggregate(Amount with sum as Total)) as part_2)}}