
Hi All,
This is the scenario.
I am working on this extension where a user is able to pick a product category to filter a dropdown of Items.
Because this user is also able to select a parent category I wrote a CodeUnit that takes in a Item Category and returns a Text containing itself and all of the sub categories:
Example:
The table I am working with is my own table "Project Item"
User chose item category: 'Projection Surfaces'
The Codeunit returns: 'Projection Surfaces|Projection Fabrics|Projection Boards|Projection Screens'
This response it put in the field Rec."Category Filter" where Rec is a "Project Item" and "Category Filter" is a field of type Text[100.
I would like to apply this filter to the TableRelation of the ProjectItem."No." field.
I tried this:
field(4; "Item No."; Code[20])
{
Caption = 'Item No.';
DataClassification = CustomerContent;
TableRelation = if ("Category Filter" = filter(<> '')) Item where("Item Category Code" = field("Category Filter"))
else
Item;
}Hi, good question.
I would have suggested to use Filter instead of Field, like this: