Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics AX (Archived)

Handling no of decimal points when writing Table records to a text file

Posted on by 362

Hello all,

I need to control the no of decimal points of a real field when we are exporting the records  from table to a text file. For which i have created an Real EDT with no  of decimal points to 2.

When we open the table, the records are displayed with 2 decimal points. However when the records are exported to text file, the Real field is showing more than 2 decimal points.

Can you please help me in handling the decimal place when we export the records to a text file.

Thank you.

Venkat

*This post is locked for comments

  • Suggested answer
    Rudi Hansen Profile Picture
    Rudi Hansen 3,987 on at
    RE: Handling no of decimal points when writing Table records to a text file

    Look at The num2str functions.

  • Venkatdax0 Profile Picture
    Venkatdax0 362 on at
    RE: Handling no of decimal points when writing Table records to a text file

    Below is the code which am using to write the data from table to Text file, where for the AccountAmountCr field i have created an EDT.

    iOWrite = new TextIo(fileName,#IO_Write);

    iOWrite.outFieldDelimiter(',');

    while select * from RWFileTmp            

           {

               if(firstWrite)

               {

                   iOWrite.writeExp(recordHeaderLine);

                   firstWrite = false;

               }

               recordWrite =[RWFileTmp.LineIdentifier,RWFileTmp.MainAccount,RWFileTmp.Description,RWFileTmp.AccountingAmountCr];

               iOWrite.writeExp(recordWrite);

           }

  • nmaenpaa Profile Picture
    nmaenpaa 101,156 on at
    RE: Handling no of decimal points when writing Table records to a text file

    How do you export? Do you have some code that does it?

    It would be great if you could share your code since otherwise it's very difficult for us to know what's wrong with it.

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,280 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,214 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans