web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Small and medium business | Business Central, N...
Suggested Answer

EDM Error With ODATA Feed and Date Datatype

(0) ShareShare
ReportReport
Posted on by 45

Hello,

Has anybody successfully managed to call a BC OData endpoint using an SSIS source component if the endpoint includes a Datetime column with only a date element?

If I set up a Query object on the Item table with the following field:

            column(LastDateModified;"Last Date Modified")
            {
                Caption = 'Last Date Modified';                
            } //#62

And expose it a web service - and then call it in SSIS I get the following error:

TITLE: System.Data
------------------------------

Unable to cast object of type 'Microsoft.OData.Edm.Library.Date' to type 'System.IConvertible'.Couldn't store <2019-10-25> in LastDateModified Column. Expected type is DateTime.

------------------------------
ADDITIONAL INFORMATION:

Unable to cast object of type 'Microsoft.OData.Edm.Library.Date' to type 'System.IConvertible'. (System.Data)

pastedimage1575834694818v3.png

Now it is a DateTime but only with the date element (and another below with only the time element). But for some reason the OData metadata is expecting a Date field.

pastedimage1575834646886v2.png

The annoying this is that if fails at the OData component - i.e., I don't even have the chance to pass it through another component like a conversion or derived column.

I'm trying to avoid having to write c# script tasks for what should be a fairly simple requirement.

Any help much appreciated.

I have the same question (0)
  • bmarriott Profile Picture
    15 on at

    Did you ever get anywhere with this?

  • Suggested answer
    keoma Profile Picture
    32,729 on at

    last date modified is a date field in bc. you could instead create a datetime value from that date value using function CREATEDATETIME(Date, Time).

  • sdjensen75 Profile Picture
    20 on at

    Has anyone found a solution for this using BC queries? I can't get them to work with any kind of date field like Posting Date and Last DateTime Modified from G/L Entry.

  • bmarriott Profile Picture
    15 on at

    I've had various tries at it but "no" is the short answer. My next attempt was going to be adding a table extension to add a date/time field specifically for this. But if the 'Last DateTime Modified' doesn't work not sure this will either.

    Pretty annoying as BC doesn't seem to want to play nicely with other Microsoft services...

  • sdjensen75 Profile Picture
    20 on at

    Hi bmarriott,

    I agree, I am very disappointed about the options you have with queries. I am a BI developer and have been working with BI for NAV for many years. We have a standard (rapid start) BI solution for NAV build by pulling data direct from NAVs SQL database (Native in the old days) and now I am trying to convert this data warehouse / cube to work with BC Cloud.

    I just wish it would be posible to define a query that would return data as they are saved in the SQL database - Option field (and new enums) as integer and dates as datatime - Also really annoying that you can't get a query to return the field with the name they have in the database, as I now have to rebuild our staging area of our Data Warehouse and all the code for our dimension and fact tables.

    If I code the "queries" as pages instead it seems like I can code these to return what I want, but I am told that pages perform slower than queries and that I can't use incremental data load with pages either.

  • bmarriott Profile Picture
    15 on at

    We've had a client who's using CData to extract data. Partly as they had an existing third party reporting solution which used that, but also as we couldn't offer a solution...

    Did find this which might be worth voting for: experience.dynamics.com/.../

  • gaupop-4423 Profile Picture
    15 on at

    Hi, I am facing exact same issue. Were you able to get this resolved?

    Not able to read the value at the first place, even before trying to use data conversion in SSIS

    Any inputs much appreciated!!

  • sdjensen75 Profile Picture
    20 on at

    Hi,

    We ended up with dropping SSIS and using Azure Data Factory instead as we were only able to get 4 decimals from numeric fields through Business Central OData queries with SSIS.

    We did however find a solution for the date problem in SSIS. In the BC query we split the date columns in to Date, Month and Year so instead of 1 field with the date we got 3 fields and then we put those fields back together to a data in SSIS before dumping the data into our source.

  • gaupop-4423 Profile Picture
    15 on at

    Thanks for your response @sdjensen75. I am not sure how to change the BC query, as its only a source for me and I can change anything in SSIS but in source.

    Also my issue is:

    SSIS expects the data to be in DateTime, but Odata v4 (BC) is providing in Date format.

    data from the url - "DateQuoteCreated":"2020-09-08"

    Source Metadata

    <Property Name="DateQuoteCreated" Type="Edm.Date">

    Error while trying to preview data in SSIS:

    Unable to cast object of type 'Microsoft.OData.Edm.Library.Date' to type 'System.IConvertible'.Couldn't store <2020-09-08> in DateQuoteCreated Column. Expected type is DateTime.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Small and medium business | Business Central, NAV, RMS

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 2,468

#2
YUN ZHU Profile Picture

YUN ZHU 923 Super User 2025 Season 2

#3
Sumit Singh Profile Picture

Sumit Singh 607

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans