Skip to main content

Notifications

Announcements

No record found.

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

I want to add filter on tablerelation where the "User Name" <> rec."User Name"

Posted on by 184

I want to filter on table relation so i get all the user except the user in the record, I tried to write it like this but it gives error 
tablerelation = user."User Name" where ("User Name" <> field("User Name") 
do you know any way I can do it like that?

  • Suggested answer
    YUN ZHU Profile Picture
    YUN ZHU 73,565 Super User 2024 Season 2 on at
    RE: I want to add filter on tablerelation where the "User Name" <> rec."User Name"

    Hi, If it is a fixed value, it is possible, but for the field, it is recommended to use the method mentioned by Daniele and Nitin.

    pastedimage1673842257684v2.png

    pastedimage1673842246165v1.png

    Hope this helps as well.

    Thanks.

    ZHU

  • Suggested answer
    Inge M. Bruvik Profile Picture
    Inge M. Bruvik 32,748 Super User 2024 Season 1 on at
    RE: I want to add filter on tablerelation where the "User Name" <> rec."User Name"

    I have not tested it myself. But there is a chance it could work if you use a filter value in your table relation instead of comparing two field values directly.

         TableRelation = User."User Name" where ("User Name" = filter (<>= %1),User."User Name");

    learn.microsoft.com/.../devenv-tablerelation-property

  • Suggested answer
    Nitin Verma Profile Picture
    Nitin Verma 21,091 Super User 2024 Season 1 on at
    RE: I want to add filter on tablerelation where the "User Name" <> rec."User Name"

    Hi,

    the operator <> you used is not possible to put here with this property, You can use either Onlookup of that field trigger.

    trigger OnLookup()

    begin

       ...

    end;

  • Suggested answer
    DAnny3211 Profile Picture
    DAnny3211 9,272 Super User 2024 Season 1 on at
    RE: I want to add filter on tablerelation where the "User Name" <> rec."User Name"

    hi

    it is not feasible to do what you wrote

    you'd better do a lookuo in AL in the onlookup trigger of the field

    https://yzhums.com/5985/

    DAniele

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,253 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,188 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans