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

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Answered

I am trying to get the data type of the Time field it is giving as integer instead of time

(0) ShareShare
ReportReport
Posted on by 302

Hello All,

I am trying to import values from sql to d365fo. There are few Time fields which are denoted as Integer field in sql (for eg: WMSArrivalHandlingTime in InventTable) so I am getting data violation error. Is there any way to over come this?

Map				fieldMaps = new Map(Types::String, Types::String);
        SysDictTable       dictTable;
        SysDictField       dictField;
        int             i, cnt;
   
        dictTable = new SysDictTable(tableName2Id(DMFEntity::find(contract.parmEntityName()).TargetEntity));
        cnt = dictTable.fieldCnt();
        for (i= 1; i<=cnt;i  )
        {
            dictField = new SysDictField(tableName2Id(DMFEntity::find(contract.parmEntityName()).TargetEntity),dictTable.fieldCnt2Id(i));
            fieldMaps.insert(dictField.name(), enum2Str(dictField.baseType()));
        }

        return fieldMaps;

I tried this to get the data type but as I am getting integer I couldnt able to achieve the same.

Thanks.

I have the same question (0)
  • nmaenpaa Profile Picture
    101,160 Moderator on at
    RE: I am trying to get the data type of the Time field it is giving as integer instead of time

    What do you mean by "import values from SQL to D365FO"? Can you describe your scenario in a bit more detail?

    What error are you getting? Could you share the error message? Time field is an integer (seconds from midnight) in D365 as well.

  • Wekey Profile Picture
    302 on at
    RE: I am trying to get the data type of the Time field it is giving as integer instead of time

    I am importing values from external sql DB. I am fetching records from external DB and creating a CSV file and creating a DMF project with that CSV. The value of the field is 0 as it is a integer field in the sql and it is the same in csv.

    So during the import process I am getting data violation error during the import process in the time field. I am creating the csv in code as well as the dmf project in code everything is happening in the backend. I checked and see the value has to be 0:00 in the csv which resolved that error instead of 0.

    So I tired the above code and if the data type is time I will use the the time2str value so that the csv holds the respective format.

  • nmaenpaa Profile Picture
    101,160 Moderator on at
    RE: I am trying to get the data type of the Time field it is giving as integer instead of time

    Ok, so do you still have some problem?

    Even though time is stored as integer in D365 database, in a data entity it's exposed in human readable format (HH:MM). So you indeed might need to convert the value with time2str in your code.

  • André Arnaud de Calavon Profile Picture
    299,030 Super User 2025 Season 2 on at
    RE: I am trying to get the data type of the Time field it is giving as integer instead of time

    Hi Wekey,

    Is the value always '0'? Or do you expect values in the future? If it will be zero anytime, why are you mapping the field?

  • Wekey Profile Picture
    302 on at
    RE: I am trying to get the data type of the Time field it is giving as integer instead of time

    Yes Nikolaos, I am facing the issue. I want to convert the format somehow but I couldn't able to figure out how to fetch the time data type in order to achieve the same.

    Andre for now it is 0 it can have values also it is not particular to one entity its a generic process where they can process this for any entity so I somehow need to figure out a way to find that this is time field so it has to be converted.

    Thanks

  • nmaenpaa Profile Picture
    101,160 Moderator on at
    RE: I am trying to get the data type of the Time field it is giving as integer instead of time

    You either need to convert the value before importing the data to D365, or add a virtual integer field in your entity. Then map your source integer field to that field, and convert it to "time string" in mapEntityToDataSource method of your entity.

  • Wekey Profile Picture
    302 on at
    RE: I am trying to get the data type of the Time field it is giving as integer instead of time

    As this is not generic to particular entity I will not be able to do that as mentioned it is used in a generic way where user will be able to choose the entity.

  • Verified answer
    nmaenpaa Profile Picture
    101,160 Moderator on at
    RE: I am trying to get the data type of the Time field it is giving as integer instead of time

    Then it's best if you can convert it already at the source.

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…

Abhilash Warrier – Community Spotlight

We are honored to recognize Abhilash Warrier as our Community Spotlight honoree for…

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
CA Neeraj Kumar Profile Picture

CA Neeraj Kumar 2,177

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 860 Super User 2025 Season 2

#3
Sohaib Cheema Profile Picture

Sohaib Cheema 593 User Group Leader

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans