Skip to main content

Notifications

Community site session details

Community site session details

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

using Rec.Setview and Rec.SetRange

(0) ShareShare
ReportReport
Posted on by 350

I am trying to find the right order here. I am using Rec.Setrange to exclude Blocked items, and also want to use item.setview to allow the user to use aditional filters.

it seems to me that setview is reversing prior setrange calls?

what is the right order here?

a)

                Items.SetView(MyConfigTable.ItemView); // Set filter from Text input
                Items.SetRange(Blocked, false); // always exclude blocked items
                Items.SetRange("Purchasing Blocked", false); // always exclude blocked items
b)
                
                Items.SetRange(Blocked, false); // always exclude blocked items
                Items.SetRange("Purchasing Blocked", false); // always exclude blocked items
                Items.SetView(MyConfigTable.ItemView); // Set filter from Text input

Bonus: 

how, and should 
                Items.SetFilter(Blocked, '%1', false);
be used here?

  • Suggested answer
    YUN ZHU Profile Picture
    81,256 Super User 2025 Season 1 on at
    RE: using Rec.Setview and Rec.SetRange

    Hi, the following are two usage examples that hopefully give you some hints.

    https://yzhums.com/21004/

    https://yzhums.com/21007/

    Thanks.

    ZHU

  • benovic Profile Picture
    350 on at
    RE: using Rec.Setview and Rec.SetRange

    Thank you Inge!

    Also note to readers, check that you have "SetTableView()" AFTER Setrange and Setview, otherwise nothing works ;)

  • Suggested answer
    Inge M. Bruvik Profile Picture
    1,011 Moderator on at
    RE: using Rec.Setview and Rec.SetRange

    You can not use Setview if you want to retain the filters you have set before you use setview.

    Setview will replace any prior filters you have set.

    So the correct order will be A.

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

🌸 Community Spring Festival 2025 Challenge 🌸

WIN Power Platform Community Conference 2025 tickets!

Jonas ”Jones” Melgaard – Community Spotlight

We are honored to recognize Jonas "Jones" Melgaard as our April 2025…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 294,033 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 232,854 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,158 Moderator

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans