Skip to main content

Notifications

Announcements

No record found.

Business Central forum
Suggested answer

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

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
    Stefan Piffer 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
    Rehan Satti 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
    samerabd 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
    Rehan Satti 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
    samerabd 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
    samerabd 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
    Rehan Satti 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 

Helpful resources

Quick Links

Replay now available! Dynamics 365 Community Call (CRM Edition)

Catch up on the first D365 Community Call held on 7/10

Community Spotlight of the Month

Kudos to Saurav Dhyani!

Congratulations to the June Top 10 community leaders!

These stars go above and beyond . . .

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 288,459 Super User

#2
Martin Dráb Profile Picture

Martin Dráb 225,783 Super User

#3
nmaenpaa Profile Picture

nmaenpaa 101,148

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans