dewin
dewin

Reputation: 21

BC AL: How to perform lookup using temporary record and a base app page? + get filter

a beginner here, i want to know what do y'all usually do when you need to perform lookup, based on temporary record, but you want to use base page, and also get the filter. Getselection filter will do, or maybe manually constructed filter using '|' will also do.

Passing the temp table to page works using Page.RunModal(Page::xxx, tempRec) but i am not sure how to get the filters.

Another workaround i've tried is making a custom page just for this lookup, use get-set procedure. But this is not ideal if i am developing for on-prem right? (license-wise)

Mind sharing other ideas? Cheers!

Upvotes: 1

Views: 145

Answers (1)

kaspermoerch
kaspermoerch

Reputation: 16560

It somewhat depends on which page you are running. Some of the existing pages already have a GetSelectionFilter procedure defined that you can use for this purpose.

An example could be on the Location List page:

procedure GetSelectionFilter(): Text
var
    Loc: Record Location;
    SelectionFilterManagement: Codeunit SelectionFilterManagement;
begin
    CurrPage.SetSelectionFilter(Loc);
    exit(SelectionFilterManagement.GetSelectionFilterForLocation(Loc));
end;

If the default page you are using doesn't have this procedure defined you can define it yourself using a pageextension object.

You might want to just get the selection in which case you need to pass a record variable as var to assign the filter to that:

procedure GetSelectionFilter(var Location: Record Location): Text
begin
    CurrPage.SetSelectionFilter(Location);
end;

Upvotes: 0

Related Questions