Saturday, March 18, 2017

D365O - Import CSV data through Data entity

Data entity is a new concept comes with D365O release where each entity related data can be accessed from a single view.

A data entity is an abstraction from the physical implementation of database tables. For example, customer related data is stored in different tables in AX which could be customer address (access from  LogisticsPostalAddress), customer name (access from DirPartyTable), and customer electronic address (access from LogisticsElectronicAddress).

Complete details are well explained here

Let's create new data entity to import data from a CSV file, this data entity uses only one table to keep it simple. My following posts will show how to import data into through data entities using multiple tables.

Create a new table [Optional step]

I created a new table for this example.

Create new data entity

Method 1:

Method 2:

Add new item for Data entity

Provide table as primary datasource

Click Next and mark convert labels to field names

Data entity will look like this in Visual Studio

With both above methods (whatever you choose) it created few artifacts in your project.

- data entity
- security privileges
- staging table

Build your project

Press Ctrl + Shift + B or Right click on project and Build

Synchronize your tables by Right click on project and Sync 

Validate staging table properties

Set the configuration key to DMF and all other properties should be same as set below.

Import data using this data entity

System administration | Data management

Provide a name, choose data source as CSV, and select entity name from the list. Upload file to import.

My sample file has this data

101, Faisal
102, Fareed
103, Mohammad

It prompts with fields mapping error

Click on View map and connect fields as shown

Refresh page to view this screen and click Run project.

Follow next few prompts and execute the batch job to import data into the staging table, verify data in the staging table. Import data into the target which will change the transfer status to completed.

Open DataImport data from table browser to see data.

This data entity creates view in SQL server, you can even play around with the created view in SQL server.


No comments:

Post a Comment

I will appreciate your comments !