Showing results for 
Search instead for 
Did you mean: 
Frequent Visitor

Dynamic Collection with ForAll

I want to make some analysis on the table. Say, I want to know how many records for every user are not filled correctly. So I do the following:

 ForAll (UserList;  Collect(DueRecords; {Name : UserNameFromUserList; EmptyRecords: CountRows( Filter(MainTable; UserName = UserNameFromUserList And IsBlank (ToBeFilledField)})
I get this silly 500 limit delegation.

So I do the following: 

ForAll (UserList;  Collect(TempCollection; Filter(MainTable; UserName = UserNameFromUserList And IsBlank (ToBeFilledField)) ;; Collect(DueRecords; Name : UserNameFromUserList; EmptyRecords: CountRows( TempCollection)

Now I get this silly error "Can't use this function with ForAll".

So what do I do??

Community Support
Community Support

Could you please take a try to switch the Collect outside of the Forall () function?

Besides, it would be much helpful if you could share an exmaple of the data you are working with, and the expected result you would like to achieve.


We will see if we could offer a better workaround.




Community Support Team _ Michael Shao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

There are: 1. Client 2. Manager (seller) 3. Collector (debt officer). Each collector has 5-6 managers, which have 50-300 clients. Some clients have debts. So, I want to make a stats for each collector: clients number, overall debt, how many clients (records) are without actions... If I bind every collector to a client with corresponding field then in case of adding (removing/swaping) a manager to collector I will have to patch hundred of records each time instead of assigning (patching) just one record in EmployeeSPList.


For now a clients collection for 1 collector is made like this:

1. Collect from sharepoint list (Employees) all managers with collectors name in "Collector" field.

2. ClearCollect(CollectorClients; ForAll (ManagerCollection; Filter (Clients; Manager=Result (or ManagerName)))

But how to make the overall stats?  Get stats for every collector in a table?

Collector James - 8 managers; 105 clients; 100 000$ overal debt; 34 records without action (IsEmtpy field)

Collector John- 6 managers; 305 clients; 200 000$ overal debt; 4 records without action (IsEmtpy field)

Collector Bryan- 12 managers; 15 clients; 10 000$ overal debt; 3 records without action (IsEmtpy field)

Collector Gregory- 8 managers; 55 clients; 15 000$ overal debt; 14 records without action (IsEmtpy field)

Frequent Visitor

Any ideas? Other words I need to put one loop into another. One "ForAll" into another, with dynamic (clearable) table (collection).

Helpful resources

PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

MBAS Attendee Badge

Claim Your Badge & Digital Swag!

Check out how to claim yours today!


Demo Extravaganza is Back!

We are excited to announce that Demo Extravaganza for 2021 has started!

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

Top Solution Authors
Top Kudoed Authors
Users online (33,103)