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 :
Finance | Project Operations, Human Resources, ...
Answered

Clear multiple ranges of same field on data source

(1) ShareShare
ReportReport
Posted on by 8
Hello,
 
I have a scenario where I have added multiple ranges (as OR) on a datasource field using a multi select lookup.
I have used a loop to get the selected values and used:
qbds.clearRange(fieldNum(table, field));
for (int i = 1; i<=conLen(conValues); i++)
        {
            qbds.addRange(fieldNum(table,
                field)).value(queryValue(conPeek(conValues, i)));                    
        }
The problem with the clear range is that it is only removing one occurence of the field range and it is keeping all the other previous ranges on the field.
Is there any way to clear all occurences of the field range?
I have the same question (0)
  • Verified answer
    Martin Dráb Profile Picture
    237,965 Most Valuable Professional on at
    Yes, it is possible. You could utilize the second parameter of clearRange() (_occurrence), but I think it's easier to simply call clearRange() with a single parameter repeatedly.
     
    You can either use a for loop (rangeCount() tells you how many times you need to run it), you a while loop checking if there is any range remaining (by utilizing findRange()).
  • Jason0810M Profile Picture
    8 on at
    Thanks Martin.
    The rangeCount would not be feasible to use for me as there are many ranges on several other fields.
    I've tried the findRange with the while loop and it works perfectly fine.

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 > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Martin Dráb Profile Picture

Martin Dráb 503 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 434 Super User 2025 Season 2

#3
BillurSamdancioglu Profile Picture

BillurSamdancioglu 278 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans