I think I understand what you mean:
you want to use a global variable in the table relation filter.
but unfortunately this is not possible, according to the documentation:
TableRelation Property - Business Central | Microsoft Learn
as an alternative to the table relation you can set the OnLookup trigger like this:
field(50517; "Industry"; Code[20])
{
DataClassification = ToBeClassified;
Caption = 'Industry';
trigger OnLookup()
var
DimensionValue: Record "Dimension Value";
DimensionValuesPage: Page "Dimension Value List";
MyVariable: Code[20];
begin
MyVariable := 'INDUSTRY';
DimensionValue.SetRange("Dimension Code", MyVariable);
if DimensionValue.FindSet() then begin
DimensionValuesPage.LOOKUPMODE := true;
DimensionValuesPage.SetTableView(DimensionValue);
if DimensionValuesPage.RunModal() = ACTION::LookupOK then begin
DimensionValuesPage.GetRecord(DimensionValue);
"Industry" := DimensionValue.Code;
end;
end;
end;
}
Don't forget to help the community by Verifying the answer and Like it if your question has been answered. It will let others know that the topic has verified answer.
Thanks & Regards,
Gian