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

Announcements

Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

how to fetch the docuref table data with respect to purchase order in PO Report

(0) ShareShare
ReportReport
Posted on by 1,737

hai,

i want to fetch the notes field from the docuref table in the Purchase order Confirmation Report, 

but i didn't find out the Relation Between These two tables,

how to solve these issue.

*This post is locked for comments

I have the same question (0)
  • Verified answer
    Community Member Profile Picture
    on at

    Every attachment is reference in DocuRef in following relation.

    DocuRef.RefTableId

    DocuRef.RefRecId

    In your case if you are fetching Notes attached to PO.

    PurchTable           purchTable;

    DocuRef               docuRefLocal;

    select firstonly purchTable where purchTable.PurchId == 'XXXXXX';

    select firstonly docuRefLocal

    where docuRefLocal.RefTableId == purchTable.TableId

    && docuRefLocal.RefRecId == purchTable.RecId

    && docuRefLocal.TypeId == 'Note';

    info(strfmt('%1', docuRefLocal.Notes));

  • srinivas pamidi Profile Picture
    1,737 on at

    thank you it is working.

  • Martin Dráb Profile Picture
    238,618 Most Valuable Professional on at

    I marked the verified answer for you, so everybody can see that the problem has been resolved and can easily locate the answer.

    Please do it by yourself next time.

  • srinivas pamidi Profile Picture
    1,737 on at

    hai qureshi,

    it is fine for only one Note in the document handling.

    how to get the Two or more Notes.

  • Martin Dráb Profile Picture
    238,618 Most Valuable Professional on at

    The relation is exactly the same for more records. If you want to fetch more records, use while select. You'll find details in documentation.

  • srinivas pamidi Profile Picture
    1,737 on at

    hai martin,

    i am writing this following code i am getting only one note in the Purchase order Report.

    select purchTable where purchTable.PurchId == PurchId;

               select docuRef

               where docuRef.RefTableId == purchTable.TableId

               && docuRef.RefRecId == purchTable.RecId

               && docuRef.TypeId == 'Note';

    now tell me where add the "while " in that code.

  • Martin Dráb Profile Picture
    238,618 Most Valuable Professional on at

    MSDN: while select Statements [AX 2012]

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Congratulations to our 2025 Community Spotlights

Thanks to all of our 2025 Community Spotlight stars!

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans