Skip to main content

Notifications

Announcements

No record found.

Power Platform integration forum
Unanswered

Need Help on Forall and Patch Function

Posted on by
Hi All,
 
Im new to Power Platform. I need help on following.
 
In my app, i'm creating multiple records and after that im creating collection of records to calculate percentage of column values on filtered rows only.
 
So, after calculating percentages for filtered rows , I want to paste calculated percentage values in their respective columns for all filtered rows in single click.
 
For that i used Forall and Patch function, But in my Sharepoint list it is pasting values in last submitted record only and not for all filtered rows.
 
request anyone to address my issue.
 
// Filter records based on the selected FrameID
ClearCollect(CollPerct, Filter('FAG Sheet Measured', FID = DataCardValue1.Text));
 
// Calculate the sums and percentages
Set(VarFAGPosSum, Sum(CollPerct, PositionScore));
Set(VarFAGFlushSum, Sum(CollPerct, FlushScore));
Set(VarFAGBothSum, Sum(CollPerct, BothScore));
Set(VarRowsCount, CountRows(CollPerct));
Set(FAGPosPerct, VarFAGPosSum / VarRowsCount);
Set(FAGFlushPerct, VarFAGFlushSum / VarRowsCount);
Set(FAGBothPerct, VarFAGBothSum / VarRowsCount);
 
// Update respective columns of all filtered rows with the calculated percentages
ForAll(
    'FAG Sheet Measured',
    Patch(LookUp('FAG Sheet Measured',FID=DataCardValue1.Text),
        { FAGPos: FAGPosPerct, FAGFlush: FAGFlushPerct, FAGBoth: FAGBothPerct }
    )
);

Helpful resources

Quick Links

Dynamics 365 Community Update – Sep 16th

Welcome to the next edition of the Community Platform Update. This is a weekly…

Announcing Our 2024 Season 2 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 290,353 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 228,251 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,148

Leaderboard

Product updates

Dynamics 365 release plans