Skip to main content

Notifications

Community site session details

Community site session details

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

Business central Apply filter on tablerelation with variables and multiple filter values

(0) ShareShare
ReportReport
Posted on by 70

i need to make tablerelation on the Item No. so that i can pick item but the filter must be if empty or have a value like the header variable but how do i make this?

i'm trying to do something like this: tableRelation =item where(reservedbycus=const(' '),reservedbycus=(field(cusno));

it's returning empty list .

  • Stefan Piffer Profile Picture
    5 on at
    RE: Business central Apply filter on tablerelation with variables and multiple filter values

    I stumbled over a similar problem, but as Rehan Satti wrote, you need to use the |.

    In my case it was by using two filter values for the same enum:

    TableRelation = "Price List Header" where("Price Type" = filter(Sale), "Source Group" = filter(Customer), Status = filter(Active), "Amount Type" = filter(Price | Any));

  • Suggested answer
    Rehan Satti Profile Picture
    634 on at
    RE: Business central Apply filter on tablerelation with variables and multiple filter values

    You can do some think like this I am linking a custom shipto code field to standard table ship to codes

     TableRelation = "Ship-to Address".Code where("IsShip-to-Address" = const(true), "Customer No." = field("Sell-to Customer No."));
    In this exampel I am linking the shipto address code from a 
  • samerabd Profile Picture
    70 on at
    RE: Business central Apply filter on tablerelation with variables and multiple filter values

    how is that? you're telling me there is no way to apply 2 filters on 1 field or that i'm writing it wrong?

  • Rehan Satti Profile Picture
    634 on at
    RE: Business central Apply filter on tablerelation with variables and multiple filter values

    I think you need to find workaround in your logic.

  • samerabd Profile Picture
    70 on at
    RE: Business central Apply filter on tablerelation with variables and multiple filter values

    Well it's not working or operator gives error

  • samerabd Profile Picture
    70 on at
    RE: Business central Apply filter on tablerelation with variables and multiple filter values

    it was fixed by just removing the const('') now it give me the items that have reservedbycus empty and the ones with the cusno value

  • Suggested answer
    Rehan Satti Profile Picture
    634 on at
    RE: Business central Apply filter on tablerelation with variables and multiple filter values

    You have to use Or '|' between your filter.

    tableRelation =item where(reservedbycus=const(' ') | reservedbycus=(field(cusno));

    I am not sure what would be axect filters regarding your condition, However follow the link 

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

Jainam Kothari – Community Spotlight

We are honored to recognize Jainam Kothari as our June 2025 Community…

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

Leaderboard > Small and medium business | Business Central, NAV, RMS

#1
Sohail Ahmed Profile Picture

Sohail Ahmed 1,452

#2
YUN ZHU Profile Picture

YUN ZHU 1,313 Super User 2025 Season 1

#3
Gerardo Rentería García Profile Picture

Gerardo Rentería Ga... 1,083 Most Valuable Professional

Featured topics

Product updates

Dynamics 365 release plans