web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Can i prevent adding a...
Power Apps
Answered

Can i prevent adding a value inside a child SharePoint list if the Sum of certain value for all the child under a parent record exceeds a number

(0) ShareShare
ReportReport
Posted on by 3,506

I have 2 Parent/Child SharePoint lists:-

 

1) Project Master

2) Activities

 

The Activities list has a lookup field to the Project Master, as follow:-

 

johnjohn123_0-1630355095032.png

 

now the Activities Child list contain a field named task weight of type numeric>> and i want to prevent having the sum of all tasks weight under certain project to exceed 100.. so when i add/edit an activity item inside a power app form >> can i Sum the weight for all the other tasks + the task been created/edit and show a message if the sum exceed 100?

 

thanks

Categories:
I have the same question (0)
  • Verified answer
    v-xiaochen-msft Profile Picture
    on at

    Hi @johnjohn123 ,

     

    You could use if() function and notify() function.

    I did a demo for you.

    I have a parent list 'LIST160' and a son list 'LIST161'. 'LIST161' has a lookup column to 'LIST160'. Its related column is ID column. If I want to patch a new item ,i could use If() function .

    vxiaochenmsft_0-1630373539592.png

    vxiaochenmsft_5-1630373646633.png

     

    Add a button control and set its onselect property to:

    If(Value(TextInput1.Text)+Sum(Filter(LIST161,MyLookup_to_LIST160.Value=1),MyNumber)<=100,Patch(LIST161,Defaults(LIST161),{Title:"Test3",MyNumber:Value(TextInput1.Text),MyLookup_to_LIST160:{Id:1,Value:1}}),Notify("Error",NotificationType.Error))

     

    vxiaochenmsft_1-1630373586563.png

     

    The result is as follows:

    vxiaochenmsft_2-1630373603664.png

    vxiaochenmsft_3-1630373613591.png

    vxiaochenmsft_4-1630373626299.png

     

    Best Regards,

    Wearsky

     

     

     

     

     

     

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 711 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 319 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard