[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]
Subject: [OASIS Issue Tracker] (ODATA-9) allow expressions in the $select query option
[ https://issues.oasis-open.org/browse/ODATA-9?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=59652#comment-59652 ]
Ralf Handl edited comment on ODATA-9 at 6/24/15 4:53 PM:
---------------------------------------------------------
Adding a calculated field without aggregating the result can be achieved via $apply:
GET Products?$apply=groupby((<key properties, other properties to include in projection>),aggregate(<expr> as <propertyname>, ...))
Having to list all properties desired in the selection plus the key properties is a bit clumsy, so a shortcut syntax would be convenient, e.g.
GET Products?$apply=calculate(<expr> as <propertyname>, ...)
The "calculate" transformation would keep all properties and instances of the input set and just add the calculated properties to each instance. This can be specified in a new CSD of the Extension for Data Aggregation without having to change the Core specifications.
was (Author: ralfhandl):
Adding a calculated field without aggregating the result can be achieved via $apply:
GET Products?$apply=groupby((<key properties, other properties to include in projection>),aggregate(<expr> as <propertyname>, ...))
Having to list all properties desired in the selection plus the key properties is a bit clumsy, so a shortcut syntax would be convenient, e.g.
GET Products?$calculate=<expr> as <propertyname>, ...
Instead of a new system query option this could also be done as a new set transformation for $apply:
GET Products?$apply=calculate(<expr> as <propertyname>, ...)
The "calculate" transformation would keep all properties and items of the input set and just add the calculated fields to each item. This form could already be specified with a new CSD of the Extension for Data Aggregation.
> allow expressions in the $select query option
> ---------------------------------------------
>
> Key: ODATA-9
> URL: https://issues.oasis-open.org/browse/ODATA-9
> Project: OASIS Open Data Protocol (OData) TC
> Issue Type: Improvement
> Components: OData Extension for Data Aggregation, OData Protocol, OData URL Conventions
> Affects Versions: V4.0_WD01
> Environment: [Proposed]
> Reporter: Andrew Eisenberg
> Labels: GoodIdea, Usability
> Fix For: V4.01_WD01
>
>
> OData could be extended to allow expressions in the $select query option, allowing derived values to be returned along with the properties of an entity.
> This could be expressed as:
> http://odata.netflix.com/v2/Catalog/Titles?$select=Name,substring(ShortSynopsis,20) as Summary
> or
> http://odata.netflix.com/v2/Catalog/Titles?$select=Name&$extendedSelect=substring(ShortSynopsis,20) as Summary
--
This message was sent by Atlassian JIRA
(v6.2.2#6258)
[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]