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...
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?

I have the same question (0)
  • Suggested answer
    Inge M. Bruvik Profile Picture
    1,105 Moderator on at

    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.

  • benovic Profile Picture
    350 on at

    Thank you Inge!

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

  • Suggested answer
    YUN ZHU Profile Picture
    95,329 Super User 2025 Season 2 on at

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

    https://yzhums.com/21004/

    https://yzhums.com/21007/

    Thanks.

    ZHU

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,226

#2
Jainam M. Kothari Profile Picture

Jainam M. Kothari 2,047 Super User 2025 Season 2

#3
YUN ZHU Profile Picture

YUN ZHU 1,257 Super User 2025 Season 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans