Skip to content

Commit

Permalink
"Implemented query to fetch top 5 consumers in Dynamics 365 Business…
Browse files Browse the repository at this point in the history
… Central

- Created a new query 'Top 5 Consumers' with a normal query type
- Defined query properties: caption, order by, and top number of rows
- Utilized dataitem 'Cust. Ledger Entry' with filters and columns for customer information and sales
- Implemented aggregate function 'Average' for sales
- Organized code with clear variable declarations and trigger sections
- Improved code readability by using descriptive names and proper indentation"
  • Loading branch information
kibexd committed Jun 19, 2024
1 parent 9ee2721 commit 053841c
Show file tree
Hide file tree
Showing 5 changed files with 89 additions and 3 deletions.
4 changes: 2 additions & 2 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
"server": "http://localhost:8080/BC210/",
"serverInstance": "BC210",
"authentication": "Windows",
"startupObjectId": 50106,
"startupObjectType": "Query",
"startupObjectId": 22,
"startupObjectType": "Page",
"breakOnError": "All",
"launchBrowser": true,
"enableLongRunningSqlStatements": true,
Expand Down
Binary file modified Default Publisher_ALM_1.0.0.0.app
Binary file not shown.
2 changes: 1 addition & 1 deletion HelloWorld.al
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ pageextension 50100 CustomerListExt extends "Customer List"
{
trigger OnOpenPage();
begin
Message('App published: Enock first Al programming ');
Message('Enock first Al programming Learning in Coretec LTD ');
end;
}
45 changes: 45 additions & 0 deletions Que50106.ListofAttachees.al
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
query 50106 "List of Attachees"
{
Caption = 'List of Attachees';
QueryType = Normal;
QueryCategory = 'Customer List';

elements
{
dataitem(Customer; Customer)
{
column(Address; Address)
{
}
column(Amount; Amount)
{
}
column(Balance; Balance)
{
}
column(City; City)
{
}
column(Contact; Contact)
{
}
column(Comment; Comment)
{
}
column(County; County)
{
}
column(EMail; "E-Mail")
{
}
column(Name; Name)
{
}
}
}

trigger OnBeforeOpen()
begin

end;
}
41 changes: 41 additions & 0 deletions QueryTop 5 Consumers.al
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
query 50107 "Top 5 Consumers"
{
QueryType = Normal; //This is a normal query
Caption = 'Top 5 Consumers'; //Obvious, the caption
OrderBy = descending(Sales__LCY_); //Query is sorted in the descending order
TopNumberOfRows = 5; //This now returns the top 5 rows
QueryCategory = 'Customer List'; //This will add this query in the CustomerList dropdown

elements
{
dataitem(Cust__Ledger_Entry; "Cust. Ledger Entry") //This is defining a data item whereby the query will retrieve data from
{
filter(Posting_Date; "Posting Date") //This filter is not actually doing anything, but it acts a s a placeholder for a filter for Posting field
{

}
//Columns below are defined and therefore inculded in the query result

column(Customer_No_; "Customer No.")
{

}
column(Customer_Name; "Customer Name")
{

}
column(Sales__LCY_; "Sales (LCY)")
{
Method = Average; //This specifies that the sales(LCY) column should be calculated using the average method
}
}
}

var
myInt: Integer;

trigger OnBeforeOpen()
begin

end;
}

0 comments on commit 053841c

Please sign in to comment.