Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics 365 | Integration, Dataverse...
Unanswered

Need Help on Forall and Patch Function

(1) ShareShare
ReportReport
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 }
    )
);

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

Congratulations 2024 Spotlight Honorees!

Kudos to all of our 2024 community stars! 🎉

Meet the Top 10 leaders for December!

Congratulations to our December super stars! 🥳

Get Started Blogging in the Community

Hosted or syndicated blogging is available! ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,661 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,379 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans