Hi All,
I'm trying to create a New Page from a New table.
The issue im having is t hat the fields do not populate themselves.
I require the following
Item
Description
SKU
Bin Code
This is my Table
table 50111 "X_Item Report" { Caption = 'X_Item Report'; DataClassification = ToBeClassified; fields { field(1; "Item No "; Text[100]) { Caption = 'Item No '; DataClassification = ToBeClassified; TableRelation = Item."No."; } field(2; Description; Text[200]) { Caption = 'Description'; DataClassification = ToBeClassified; TableRelation = Item.Description where(Description = field("Item No ")); } field(3; SKU; Code[50]) { Caption = 'SKU'; DataClassification = ToBeClassified; TableRelation = "Stockkeeping Unit"."Item No." where("Item No." = field("Item No ")); } field(4; "Bin"; Text[100]) { Caption = 'Bin of last occurance'; DataClassification = Tobeclassified; TableRelation = "Bin Content"."Bin Code" where("Item No." = field("Item No ")); } } keys { key(PK; "Item No ") { Clustered = true; } } }
I tried using a trigger, however it doesn't seem to be picking up the fields.
This is the trigger i tried using for the description
trigger OnValidate() var recDesc: Record "Item"; begin if "Item No " = "Item No " then if recDesc.get("Description") then begin "Description" := "Description" end; end;
Any assistance would be greatly appreciated
tableextension 50120 Bin extends Item { fields { field(50120; Bin; Code[30]) { TableRelation = "Bin Content"."Bin Code" where("Item No." = field("No.")); Caption = 'Bin'; DataClassification = ToBeClassified; } } local procedure YIR(var Item: Record Item; LocationCode: Code[10]; VariantCode: Code[10]) var Bin: Record "Bin Content"; begin if item.get("No.") then if Bin.get(LocationCode, Item."No.", VariantCode) then begin Bin."Item No." := Bin."Bin Code"; item.modify; end; end; } pageextension 50120 Bin extends "Item List" { layout { addafter(Type) { field(Bin; Rec.Bin) { ApplicationArea = all; Caption = 'Bin'; } } } }
Hi Nitin,
thanks again for your help with this.
I tried applying the same logic getting the "Bin Code" from the "Bin Contents" table but it doesn't seem to work either
I still cant see what im doing wrong.
Please try below
tableextension 50113 SKU extends Item
{
fields
{
field(50113; SKU; Code[30])
{
TableRelation = "Stockkeeping Unit"."Location Code" where("Item No."= field("No."));
Caption = 'SKU';
DataClassification = ToBeClassified;
}
}
local procedure YIR(var Item: Record Item; LocationCode: Code[10]; VariantCode: Code[10])
var
SKU: Record "Stockkeeping Unit";
begin
if item.get("No.") then
if SKU.get(LocationCode, Item."No.", VariantCode) then
begin
Item."Shelf No." := SKU."Shelf No.";
item.modiy;
end;
end;
}
This is what i have so far , that doesn't work
tableextension 50113 SKU extends Item { fields { field(50113; SKU; Code[30]) { TableRelation = "Stockkeeping Unit"."Location Code" where("Item No."= field("No.")); Caption = 'SKU'; DataClassification = ToBeClassified; } } local procedure YIR(var Item: Record Item; LocationCode: Code[10]; VariantCode: Code[10]) var SKU: Record "Stockkeeping Unit"; begin if item.get("No.") then if SKU.get(LocationCode, Item."No.", VariantCode) then Item."Shelf No." := SKU."Shelf No."; end; }
ok, so ive sorted that , simple errors on my part.
Now i've created a table extension to extend the "Item" table with the field "Stockkeeping Unit"
I need this to look at the item number and populate the field.
This is what i used, can someone tell how where i went wrong?
tableextension 50113 SKU extends Item
{
fields
{
field(50113; SKU; Code[30])
{
TableRelation = "Stockkeeping Unit"."Location Code" where("Location Code" = field("No."));
Caption = 'SKU';
DataClassification = ToBeClassified;
trigger OnValidate()
var
RecSKU: Record "Stockkeeping Unit";
begin
if xRec."No." = Rec."No."
then
if recSKU.get(SKU) then begin
SKU := rec.SKU
end;
end;
}
}
}
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 291,151 Super User 2024 Season 2
Martin Dráb 229,993 Most Valuable Professional
nmaenpaa 101,156