web
You’re offline. This is a read only version of the page.
close
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

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
    634 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
    634 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
    634 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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

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

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 3,229

#2
Jainam M. Kothari Profile Picture

Jainam M. Kothari 1,867 Super User 2025 Season 2

#3
YUN ZHU Profile Picture

YUN ZHU 1,153 Super User 2025 Season 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans