Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Small and medium business | Business Central, N...
Suggested answer

Filtering Lookup entries based on selection in header

(1) ShareShare
ReportReport
Posted on by 30
Hello community,

I'm pretty new in AL programming, so this might be pretty obvious to some of you.
I probably could find a solution just by having redundant data, but I want to find out what is possible in AL and have clean code. I've searched many forums, but couldn't find a fitting solution (or maybe it is really that complicated).

For the sake of better understanding I'll use a made up setup.

I have 3 (custom) tables:
1: /Bin/ (/Bin No./, Name, /Allowed Item Type/ [fruits, vegetables, sweets,...])
2: /Bin Item List/ (/Bin No./, /Custom Item No./, Amount/)
3: /Custom Item/ (/Custom Item No./, /Custom Item Type/ [fruits, vegetables, sweets,...])

I have 2 pages:
1: /Bin Header/, Document, linked to table 1
2: /Bin Item List/, List Part, linked to table 2 and Subpage of /Bin Header/.

I want the lookup for new items in the /Bin Item List/ to only contain those items with /Custom Item/./Custom Item Type/ = /Bin/./Allowed Item Type/. 

Is there a nice way to just add an additional filter without writing a new lookup page or something like that?

Thanks in advance and have a nice day
Christopher 
  • Chris Brill Profile Picture
    Chris Brill 30 on at
    Filtering Lookup entries based on selection in header
    @User:
    I'm not quite sure whether I understand your table design - but try setting a TableRelation on table 2, field Custom Item No.
    Thanks, I'm already using a table relation, but I'm looking for an easy way to add an additional filter that is depending on a variable or a return value of a function. As far as I've tried, none of the WHERE <TableFilters> - options FIELD, CONST or FILTER can handle this. 
     
     
    @YUN ZHU:
    How to create a Lookup, Drop-Down, or Option list (Single and Multi select)
    Thank you, that would solve the problem. It just seems to be so much effort (create a new page which still needs to call another function to get the filter value, create a new trigger...) for such a simple thing as adding a where statement. And there wouldn't be a table relation so this could cause problems in case of rename cascading, right?
  • Suggested answer
    YUN ZHU Profile Picture
    YUN ZHU 78,009 Super User 2025 Season 1 on at
    Filtering Lookup entries based on selection in header
    Hi, hope the following helps.
    How to create a Lookup, Drop-Down, or Option list (Single and Multi select)
     
    Thanks.
    ZHU
  • Suggested answer
    Community member Profile Picture
    Community member 13 on at
    Filtering Lookup entries based on selection in header
    I'm not quite sure whether I understand your table design - but try setting a TableRelation on table 2, field Custom Item No.
     
     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Daivat Vartak – Community Spotlight

We are honored to recognize Daivat Vartak as our March 2025 Community…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Kudos to the February Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 292,516 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,409 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans