cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Zhukov23
Level: Powered On

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

3 REPLIES 3
Community Support Team
Community Support Team

Re: Dynamic Collection with ForAll

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.

 

Regards,

Michael

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.
Zhukov23
Level: Powered On

Re: Dynamic Collection with ForAll

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)

Zhukov23
Level: Powered On

Re: Dynamic Collection with ForAll

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

Helpful resources

Announcements
thirdimage

Power Platform 24

Check it out!

thirdimage

New Badges

Check it out!

thirdimage

Power Apps Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

Top Solution Authors
Top Kudoed Authors
Users online (4,581)