web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
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 .

I have the same question (0)
  • Suggested answer
    Rehan Satti Profile Picture
    636 on at

    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 

  • samerabd Profile Picture
    70 on at

    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

  • samerabd Profile Picture
    70 on at

    Well it's not working or operator gives error

  • Rehan Satti Profile Picture
    636 on at

    I think you need to find workaround in your logic.

  • samerabd Profile Picture
    70 on at

    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?

  • Suggested answer
    Rehan Satti Profile Picture
    636 on at

    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 
  • Stefan Piffer Profile Picture
    5 on at

    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));

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the April Top 10 Community Leaders

These are the community rock stars!

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

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 1,872 Super User 2026 Season 1

#2
YUN ZHU Profile Picture

YUN ZHU 1,110 Super User 2026 Season 1

#3
AndrewThomas81 Profile Picture

AndrewThomas81 892

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans