Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

toTimestamp client-side function #105

Draft
wants to merge 21 commits into
base: main
Choose a base branch
from
Draft

toTimestamp client-side function #105

wants to merge 21 commits into from

Conversation

HeikoTheissen
Copy link
Contributor

@HeikoTheissen HeikoTheissen commented Mar 17, 2021

Prerequisites:

<EntityType>
 <Property Name="Date" Type="Edm.Date"/>
 <Property Name="Time" Type="Edm.TimeOfDay"/>
 <Annotation Term="Common.Timestamp">
   <Apply Function="UI.toTimestamp">
    <Path>Date</Path>
    <Path>Time</Path>
    <Null/>
   </Apply>
 </Annotation>
</EntityType>

The client can delegate execution of the function to the server with

GET ~/EntityType?$compute=UI.toTimestamp(Date=Date,TimeOfDay=Time,Timezone=null) as Timestamp

or

The latter, however, makes sense only if the OData server knows the annotation definition. But then it could as well expose a Timestamp property. The whole point of annotations is that they can be contributed by a party different from the OData server. However, that party might serve as a proxy between client and server that converts the second GET request into the first.

Comment on lines 1603 to 1612
<Function Name="toTimestamp">
<Annotation Term="Core.Description" String="Representation of the given point in time as an `Edm.DateTimeOffset` whose [timezone fragment](https://www.w3.org/TR/xmlschema11-2/#nt-tzFrag) is `Z`" />
<Parameter Name="Date" Type="Edm.Date"/>
<Parameter Name="TimeOfDay" Type="Edm.TimeOfDay"/>
<Parameter Name="Timezone" Type="Edm.String">
<Annotation Term="Core.Description" String="Time zone according to the [IANA](https://www.iana.org/time-zones) standard" />
<Annotation Term="Core.LongDescription" String="If absent, the time zone of the UI (Fiori Launchpad) is implied" />
</Parameter>
<ReturnType Type="Edm.DateTimeOffset"/>
</Function>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This defines a server-side function.

We should discuss in the OData TC whether this is also the way to go for defining client-side functions, and how to mark these functions as "client-side".

Could you please open a TC jira issue?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants