[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]
Subject: [OASIS Issue Tracker] (ODATA-1163) A Case for Common Expressions
Gerald Krause created ODATA-1163: ------------------------------------ Summary: A Case for Common Expressions Key: ODATA-1163 URL: https://issues.oasis-open.org/browse/ODATA-1163 Project: OASIS Open Data Protocol (OData) TC Issue Type: New Feature Components: Protocol, URL Conventions Affects Versions: V4.01_CS01 Reporter: Gerald Krause Fix For: V4.02_WD01 Support of case expressions as known from the SQL standard would add to the ad hoc capabilities and support use cases that require such an IF-THEN-ELSE logic. Imagine case( condition_1, value_1, ..., condition_N, value_N [, else_value] ) would be available as canonical function for common expressions; an omitted else defaults to null. Here are some examples that could be addressed with it: 1. Core OData: Ad-hoc calculations with logic on the current property values: Example: Signum(x) GET ~/XValues?$compute=case(X > 0, 1,X < 0, -1, 0) as SignumX&$select=X,SignumX 2. Data Aggregation extension: Restricting aggregation to those values that occur in combination with certain groupable property values: Example: Comparing company revenues for years 2000 and 2017 GET ~/Sales?$apply=groupby((Company), aggregate(case(Time/Year eq 2000, Revenue) with sum as TotalRevenue2000, case(Time/Year eq 2017, Revenue) with sum as TotalRevenue2017)) 3. Data Aggregation extension: Defining dynamic groupable properties Example: From a collection of incidents with fine-grained state model (e.g., new, assigned, resolved, verified, reopened, closed) retrieve the aggregated count of open and closed incidents: GET ~/Incidents?$apply=compute(case(Status eq ‘Closed’, ‘Closed’, ‘Open’) as ProcessingStatus)/groupby((ProcessingStatus), aggregate($count as IncidentCount)) -- 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]