Skip to main content

Notifications

Finance | Project Operations, Human Resources, ...
Suggested answer

How to export the data from Data Entiy quickly if any virtual field is added?

(0) ShareShare
ReportReport
Posted on by 162

Hi, 

I have duplicated the GeneralJournalAccountEntryEntity . I had a requirement to add the unmapped non-computational field. It takes a lot of time to export the data. Any better way to get the data in quick manner?

  • Mohit Rampal Profile Picture
    Mohit Rampal 12,554 Super User 2024 Season 1 on at
    RE: How to export the data from Data Entiy quickly if any virtual field is added?

    Yes, mapDatasourceToEntity is called during data export. Please check my comments again.

    mapDataSourceToEntity: Data Entity Export

    mapEntityToDataSource: Data Entity Import.

  • Harshal Jain Profile Picture
    Harshal Jain 162 on at
    RE: How to export the data from Data Entiy quickly if any virtual field is added?

    Oh I was under impression that mapDatasourceToEntity is used for export as the data source fields are mapped to Entity.

  • Mohit Rampal Profile Picture
    Mohit Rampal 12,554 Super User 2024 Season 1 on at
    RE: How to export the data from Data Entiy quickly if any virtual field is added?

    I'm also referring to mapDataSourceToEntity method not mapEntityToDatasource. This data entity is ReadOnly so mapEntityToDatasource will not be called.

  • Harshal Jain Profile Picture
    Harshal Jain 162 on at
    RE: How to export the data from Data Entiy quickly if any virtual field is added?

    Hi Preetham,

    I am saying mapDatasourceToEntity method not mapEntityToDatasource. Any idea in which entity I can check for the same. Also the document which you shared is very good but I need to use the following code to fetch the customer name.

     AccountName accountName;
    
     if (this.MainAccount)// i amgetting this value at entity level
            {
                // Try to find a translation for the current user language.
                accountName = MainAccountTranslation::getLocalizedName(this.MainAccount);
            }
    
    
            // Name is a mandatory field -- if it not found after the invariant, it is likely because the Name column was not selected by the query.
            // If from a form control linked DataMethod, set CacheDataMethod to No and if the MainAccount is joined as a referenced data source and change OnlyFetchActive to No
    
            return accountName;

  • Suggested answer
    Mohit Rampal Profile Picture
    Mohit Rampal 12,554 Super User 2024 Season 1 on at
    RE: How to export the data from Data Entiy quickly if any virtual field is added?

    You can check mapDataSourceToEntity method from below article and get table buffer by finding GeneralJournalAccountEntryRecId in table's RecId. However, I don't think it will improve performance but you can try. Creating Computed method is tricky due to various conditions and method calls in display method. Another solution is to create custom table to store that accountName and use that table as dataSource in the entity. So, it will be mapped field instead of Virtual field. You have to write code in insert & update of MainAccount and MainAccountTranslation table, so if value is inserted or changed it should be updated in your custom table as well.

    nareshdax.blogspot.com/.../entity-methods-in-ax7.html

  • Suggested answer
    Bharani Preetham Peraka Profile Picture
    Bharani Preetham Pe... 3,587 Super User 2024 Season 1 on at
    RE: How to export the data from Data Entiy quickly if any virtual field is added?

    For computed column you can try this link.

    www.atomicax.com/.../part-16-action-methods-and-computed-columns

    As I said earlier you can only write postload for export and not mapentitytodatasource as the 2nd method is for import.

  • Harshal Jain Profile Picture
    Harshal Jain 162 on at
    RE: How to export the data from Data Entiy quickly if any virtual field is added?

    Hi Preetham,

    I had written the display method logic in postLoad and it gave me the performance Issue. That's why I am asking how I can write in Computed column or mapDataSourceToEntity.

  • Bharani Preetham Peraka Profile Picture
    Bharani Preetham Pe... 3,587 Super User 2024 Season 1 on at
    RE: How to export the data from Data Entiy quickly if any virtual field is added?

    For performance the way I said is good. Can you try that display method as I said?

    If not possible then you have to do that in postload method.

  • Harshal Jain Profile Picture
    Harshal Jain 162 on at
    RE: How to export the data from Data Entiy quickly if any virtual field is added?

    Hey Preetham,

    At form level they have written a display method with if and else condition, thats why I am trying to write a code. Also I need the financial dimensions seperately. For that also I would be needing the code to write.

  • Suggested answer
    Bharani Preetham Peraka Profile Picture
    Bharani Preetham Pe... 3,587 Super User 2024 Season 1 on at
    RE: How to export the data from Data Entiy quickly if any virtual field is added?

    I don't mean you to write the code. If you go with code, it will anyway impact performance. As you require the name of the account number, let's assume you have to do same in form level. So, what you do? You will add that datasource in form, give the relation and set the join property. Finally, you will get the name of the account. Similarly, you can do the same in the entity as well. That won't impact anything.

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

Announcing Our 2025 Season 1 Super Users!

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

Announcing Forum Attachment Improvements!

We're excited to announce that attachments for replies in forums and improved…

Vahid Ghafarpour – Community Spotlight

We are excited to recognize Vahid Ghafarpour as our February 2025 Community…

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,971 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 230,846 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans