Skip to main content

Notifications

Microsoft Dynamics AX (Archived)

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

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

  • Martin Dráb Profile Picture
    Martin Dráb 230,188 Most Valuable Professional on at
    RE: how to fetch the docuref table data with respect to purchase order in PO Report

    MSDN: while select Statements [AX 2012]

  • srinivas pamidi Profile Picture
    srinivas pamidi 1,737 on at
    RE: how to fetch the docuref table data with respect to purchase order in PO Report

    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
    Martin Dráb 230,188 Most Valuable Professional on at
    RE: how to fetch the docuref table data with respect to purchase order in PO Report

    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
    srinivas pamidi 1,737 on at
    RE: how to fetch the docuref table data with respect to purchase order in PO Report

    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
    Martin Dráb 230,188 Most Valuable Professional on at
    RE: how to fetch the docuref table data with respect to purchase order in PO Report

    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
    srinivas pamidi 1,737 on at
    RE: how to fetch the docuref table data with respect to purchase order in PO Report

    thank you it is working.

  • Verified answer
    Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: how to fetch the docuref table data with respect to purchase order in PO Report

    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));

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!

Community AMA December 12th

Join us as we continue to demystify the Dynamics 365 Contact Center

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,188 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans