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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

X++ Code to insert multiple columns and rows from one table to another

(0) ShareShare
ReportReport
Posted on by 755

Hey ladies and gents,

I have completed migrating data from my companies legacy system into AX and the data is only inside of a DMF table. I can see all of my data in the AOT and know it's there, but it did not go to the table associated. I've found some insert methods that allow insert or update of single records, but is there a way to insert all of the data from the DMF table to the desired AX tables.

Thank you in advance!

Russell G.

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Martin Dráb Profile Picture
    240,008 Most Valuable Professional on at

    If you can import data without any transformation, why do you bother with staging tables? And if you need some transformations (validations, number sequences etc.), what will do them? It's exactly the purpose of entity classes (and basically the purpose of the whole Data Import Export Framework).

    You really should use entity classes to copy data to target tables. Nevertheless if you still want to give up the most important part of DIXF and implement something custom, look at insert_recordset.

  • RussTG Profile Picture
    755 on at

    Thanks again Goshoom. I'm new to DAX and come from a C#. NET background. The problem I'm still having is that the EntityClass is populating the DMFtableEntity and not the AX table that I would like to be the final destination.

    I definitely need RecId generated.

    Best,

    Russell

  • Suggested answer
    Martin Dráb Profile Picture
    240,008 Most Valuable Professional on at

    There are two steps:

    1. Copying data from a source (e.g. text file) to a staging table. This is handled by SSIS and it deals with file formats etc. and doesn't care about AX business logic.
    2. Copying data from staging to target tables. This is handled by entity classes and it's all about business logic.

    If you're always getting data to staging tables, you seem to be executing the first step only!

    Open your processing group, click Copy to target, choose the data set to copy from staging and confirm.

  • RussTG Profile Picture
    755 on at

    I have executed the last step and selected Copy to target and executed the data set. The final target is DMFtableNameEntity and shows up under my tables in the AOT with all of the data. I would like the final target to be the regular AX table that already exsists.

  • Martin Dráb Profile Picture
    240,008 Most Valuable Professional on at

    It looks like the staging table. For example, DMFCustomerEntity is the staging table for customer entity.

    So copying to target doesn't work in your case. Did the job for copying data to target return any error message?

    Which entity are you using? If it's your custom entity, it seems that copying to target hasn't been implemented correctly (or at all).

  • RussTG Profile Picture
    755 on at

    The job for copying data to target did not return any errors. I'm using a custom entity and I definitely selected copy to target in the processing group menu after I successfully staged everything.

  • Martin Dráb Profile Picture
    240,008 Most Valuable Professional on at

    Okay, so the problem seems to be in your custom entity. Review/debug your code.

  • Martin Dráb Profile Picture
    240,008 Most Valuable Professional on at

    One more thing - also review your mapping from staging to target.

  • RussTG Profile Picture
    755 on at

    I'm thinking that I need to manually create the entity instead of using the wizard because of table inheritance.

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the June Top 10 Community Leaders

These are the community rock stars!

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans