Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

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

Query on Sales Header (filter by customer)

(0) ShareShare
ReportReport
Posted on by 271

Hi all,

I created a simple query calculating for all customers the items and quantity bought.

Expanded Type Data Source Name Method Type Method Group By
1 DataItem Item Ledger Entry <Item_Ledger_Entry> No
0 Column Item No. <Item_No> None Yes
0 Column Source No. <Source_No> None Yes
0 Column Quantity <Sum_Quantity> Totals Sum No

Then created a page to list the query

Expanded Type SubType SourceExpr Name Caption
1 Container ContentArea <Control1000000000> <Control1000000000>
1 Group Repeater General <General>
0 Field Number <Number> <Number>
0 Field ProdutosCliente.Item_No Nº Produto <Nº Produto>
0 Field ProdutosCliente.Source_No Nº Cliente <Nº Cliente>
0 Field ProdutosCliente.Sum_Quantity Quantidade <Quantidade>

OnOpenPage()

ProdutosCliente.OPEN;

WHILE ProdutosCliente.READ DO
NoOfrows:=NoOfrows+1;

ProdutosCliente.CLOSE;

SETRANGE(Number,1,NoOfrows);

CLEAR(ProdutosCliente);
ProdutosCliente.OPEN;

OnClosePage()

ProdutosCliente.CLOSE;

OnFindRecord(Which : Text) : Boolean

OnNextRecord(Steps : Integer) : Integer

OnAfterGetRecord()
IF NOT ProdutosCliente.READ THEN
EXIT;

After that my goal is to create an action button on the Sales Order Form, with this code, but only to list the products of the sales header sell to customer no.

How can i filter that?

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

Daivat Vartak – Community Spotlight

We are honored to recognize Daivat Vartak as our March 2025 Community…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Kudos to the February 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... 292,606 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,551 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156 Moderator

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans