Hello everyone, I'm new to AL and still learning about how the language functions. Recently, I've been trying to create a fact box that get me Item Totals by each location.
The format is so: Location Code - Item No. - Quantity Available

I'm able to get the data that I need but the issue is that I get multiple entries for one location and Item No, When I only need one entry per location. Can anyone assist me on this ? I tried playing around with the source tables and changed it to Location which helped reduce the number of results I get but then Quantity available remains at zero.
Source Code:
page 50146 "Availability by Location"
{
Caption = 'Availability by Location';
PageType = CardPart;
SourceTableTemporary = True;
SourceTable = "Item Ledger Entry";
//SourceTable = Location;
layout
{
area(Content)
{
repeater(group)
{
field("Code"; Rec."Location Code")
{
ApplicationArea = All;
}
field("Item No."; Rec."Item No.")
{
ApplicationArea = All;
}
field("Qty Available"; Rec."Quantity by Location")
{
Caption = 'Quantity Available';
ApplicationArea = All;
//"Item Ledger Entry".setCurrentKey()
DrillDown = true;
trigger OnDrillDown()
var
ILE: Record "Item Ledger Entry";
LocationMatrixPage: Page "Items by Location Matrix";
Item: Record Item;
ItemVariant: Record "Item Variant";
Text000: Label 'The record was found';
begin
ItemVariant.SetFilter("Item No.", Rec."Item No.");
PAGE.Run(50036, ItemVariant);
end;
}
}
}
}
var
Item: Record "Item Ledger Entry";
Location: Record Location;
}