Skip to main content

Notifications

Announcements

No record found.

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

  • RussTG Profile Picture
    755 on at
    RE: X++ Code to insert multiple columns and rows from one table to another

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

  • Martin Dráb Profile Picture
    231,758 Most Valuable Professional on at
    RE: X++ Code to insert multiple columns and rows from one table to another

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

  • Martin Dráb Profile Picture
    231,758 Most Valuable Professional on at
    RE: X++ Code to insert multiple columns and rows from one table to another

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

  • RussTG Profile Picture
    755 on at
    RE: X++ Code to insert multiple columns and rows from one table to another

    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
    231,758 Most Valuable Professional on at
    RE: X++ Code to insert multiple columns and rows from one table to another

    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
    RE: X++ Code to insert multiple columns and rows from one table to another

    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.

  • Suggested answer
    Martin Dráb Profile Picture
    231,758 Most Valuable Professional on at
    RE: X++ Code to insert multiple columns and rows from one table to another

    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
    RE: X++ Code to insert multiple columns and rows from one table to another

    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
    231,758 Most Valuable Professional on at
    RE: X++ Code to insert multiple columns and rows from one table to another

    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.

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

Daivat Vartak – Community Spotlight

We are honored to recognize Daivat Vartak as our March 2025 Community…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Kudos to the February Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 292,884 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,758 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156 Moderator

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans