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

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Small and medium business | Business Central, N...
Suggested Answer

Query Object convert SQL into BC Query

(1) ShareShare
ReportReport
Posted on by 7
SELECT [No], [Document Type]
FROM [Sales Header]
WHERE [Document Type] = 'Sales Order'
    OR ([Document Type] = 'Sales Quote' AND [Order Received] = 1);

I have extended a field in Sales Header /Order Received/ 

My requirement is to find all records which has  Document Type as 'Order' or Document Type as 'Quote' but when the document type is Quote it should also check if Order Received is TRUE

  can we write a query for these type of requirement?
  • Gerardo Rentería García Profile Picture
    27,623 Super User 2026 Season 2 on at
    Hi
    Surely you could apply a couple of dataitems, each with its premises, and join them. I hope this helps you a little.
    Best regards
    Gerardo
  • Suggested answer
    Dustin Wolf Profile Picture
    30 on at


    You would probably want something like this.  The DataItemTableFilter will help with the WHERE
  • Suggested answer
    YUN ZHU Profile Picture
    104,131 Super User 2026 Season 2 on at
    Hi, just add some information. If your Query is used in code, you can also use SetFilter or SetRange to add filtering. This is similar to record (table).
     
    Hope this helps.
    Thanks.
    ZHU
  • CU27040859-8 Profile Picture
    7 on at
    I have implemented but it is only showing records which has Order Received as True

    What I actually needed is ALL Sales Orders and from Sales Quote records only which as, "Order Received"  field marked as True



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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Leaderboard > Small and medium business | Business Central, NAV, RMS

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 633 Super User 2026 Season 2

#2
YUN ZHU Profile Picture

YUN ZHU 419 Super User 2026 Season 2

#3
Teagen Boll Profile Picture

Teagen Boll 236 Super User 2026 Season 2

Last 30 days Overall leaderboard

Featured topics

Microsoft Training Manuals

Product updates

Dynamics 365 release plans