Skip to main content
Post a question

Notifications

Community site session details

Community site session details

Session Id : gsjcaiUJWL2QmHWH1q3w7w
Small and medium business | Business Central, N...
Answered

Query Using Posted Purchase Invoice & Posted Purchase Credit Memo Tables

Like (2) ShareShare
ReportReport
Posted on 11 Jan 2025 12:25:54 by 61
Hi,
 
I want to create a query object in which data must be from Post.Pur.Inv Table & from Post.Pur.Crm Table,
 
Is it possible , if not then if i create two separate queries can i combine them in temp table ? 

please help me understand this concept
  • Verified answer
    One_&_Only_Naveen Profile Picture
    61 on 14 Jan 2025 at 02:40:35
    Query Using Posted Purchase Invoice & Posted Purchase Credit Memo Tables
    Thank you all for your time and advice,
     
    as suggested, I created two queries and combined them into one in a Temporary table, and it solved my issue.
     
    Also when combining them on temp table i created a procedure in table definition itself  and called in my report at onPredataitem Trigger, is it correct and efficient way to deal? ( get_Pur_Combined_data is defined in my Temp Table object definition)
     trigger OnPreDataItem()
                begin
                    Get_Pur_Combined_Data(QryPur, QryPR, From_Date, To_Date);
                end;
  • gdrenteria Profile Picture
    16,909 Most Valuable Professional on 12 Jan 2025 at 21:31:43
    Query Using Posted Purchase Invoice & Posted Purchase Credit Memo Tables

    Hi, good day
    I hope this can help you, and give you some hints.

    Data Item Links - Business Central | Microsoft Learn

    Best Regards
    Gerardo

  • Suggested answer
    Khushbu Rajvi. Profile Picture
    12,843 Super User 2025 Season 1 on 12 Jan 2025 at 05:46:44
    Query Using Posted Purchase Invoice & Posted Purchase Credit Memo Tables

    It's not possible to directly combine Posted Purchase Invoices and Posted Purchase Credit Memos in a single query in Business Central, but you can create two separate queries and combine their data into a temporary table using AL code. 

  • Suggested answer
    Alexander Drogin Profile Picture
    256 on 11 Jan 2025 at 22:12:25
    Query Using Posted Purchase Invoice & Posted Purchase Credit Memo Tables
    This would a UNION statement in SQL, and unions are not supported in BC queries. So yes, you need to create two separate queries and process results separately or insert into a temporary table.

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

🌸 Community Spring Festival 2025 Challenge 🌸

WIN Power Platform Community Conference 2025 tickets!

Jonas ”Jones” Melgaard – Community Spotlight

We are honored to recognize Jonas "Jones" Melgaard as our April 2025…

Kudos to the March 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... 293,518 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 232,594 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,158 Moderator

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans
Loading complete