The issue: Closing Dates are a problem for consumers of OData endpoints.
Does anyone know the correct way to operate on closing dates in OData?
- Given table: Date, Amount PK (Date, Amount)
- Page with the table as the source
- OData Endpoint of Page (not using API Type)
Table populated with:
Date, Sum(Amount) from GL Entries Group by Date
The “ClosingDates” Property was not included on the table field, thus any Page rendered did not communicate closing dates populated from the G/L Entries. ClosingDates = false (default) does not render the Date on a page with the C Prefix. The same page is provided as an OData Endpoint.
By setting the ClosingDates property to true, the page now correctly communicates C12/31/2019 to the user in the GUI. However, there is nothing to communicate the value during calls to web services. So we end up with what appears to be a schema issue. Recall the PK is on Date/Amount.
The only solution was to add an additional property: “IsClosingDate” to the API response to clarify “ClosingDate” in the dataset.
IsClosingDate := (PostingDate = ClosingDate(PostingDate))
This feels like a valid workaround, but then a consumer doesn’t appear to be able to fetch closing entries for a particular date.
OData Filters using the dates can’t operate on Closing Dates. $filter=(PostingDate eq 2019-12-31) Just can’t seem to find an example to query ClosingDates explicitly in OData.