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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / why this on change fun...
Power Apps
Unanswered

why this on change function does not work ?

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

I want to be able to edit the budget of a workpackage and if the sum of the budget for this specific workpackage is larger than the avaiable budget in the project table then the speficic budget for the workpackage should be set to the previous budget!

I have two tables Workpackage and Project

If(Sum(Filter(colA; Projektname = ThisItem.Projektname) ; Budget) + Value(ThisItem.Budget) - Value(LookUp(colA; ID = ThisItem.ID).Budget) <= Value(LookUp(Projektstammdaten; Projektname = ThisItem.Projektname).'Plan / Budget Faktura'); Select(Parent); ThisItem.Budget = LookUp(colA; ID = ThisItem.ID).Budget)
Categories:
I have the same question (0)
  • WarrenBelz Profile Picture
    155,940 Most Valuable Professional on at

    Hi @Anonymous ,

    I have parsed this for ease of reference

    If(
     Sum(
     Filter(
     colA; 
     Projektname = ThisItem.Projektname
     ); 
     Budget
     ) + 
     Value(ThisItem.Budget) - 
     Value(
     LookUp(
     colA; 
     ID = ThisItem.ID
     ).Budget
     ) <= 
     Value(
     LookUp(
     Projektstammdaten; 
     Projektname = ThisItem.Projektname
     ).'Plan / Budget Faktura'
     ); 
     Select(Parent); 
     ThisItem.Budget = 
     LookUp(
     colA; 
     ID = ThisItem.ID
     ).Budget
    )

    The fundamental issue if you are using this OnChange is that is is expecting an action - the first possibility is one 

    Select(Parent)

    but this is not (an action) - it is simply a statement which really belongs in a filter (it does not set anything)

    ThisItem.Budget = 
    LookUp(
     colA; 
     ID = ThisItem.ID
    ).Budget

    I am not sure exactly what you are trying to do

     

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    if Select(Parent) is executed then it goes to the gallery and update the collection !

     

    Akki2995_0-1698661746902.png

     

  • WarrenBelz Profile Picture
    155,940 Most Valuable Professional on at

    @Anonymous ,

    Yes, but this is not doing anything - it is simply a statement which you will get an error on as it is not an action.

    ThisItem.Budget = 
    LookUp(
     colA; 
     ID = ThisItem.ID
    ).Budget

     You need to specify the action required in the alternate circumstance (when you do not go to the gallery)

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    can you give me the whole code ? pls

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    i did but still does not work !

    If(
     Sum(
     Filter(
     colA; 
     Projektname = ThisItem.Projektname
     ); 
     Budget
     ) + 
     Value(ThisItem.Budget) - 
     Value(
     LookUp(
     colA; 
     ID = ThisItem.ID
     ).Budget
     ) <= 
     Value(
     LookUp(
     Projektstammdaten; 
     Projektname = ThisItem.Projektname
     ).'Plan / Budget Faktura'
     ); 
     Select(Parent); 
     true
    )
  • WarrenBelz Profile Picture
    155,940 Most Valuable Professional on at

    @Anonymous ,

    Do you get any error on the posted code. If not, I need to understand what you two options are trying to do. One is Select(Parent) - where does that go and the other is reverting to previous budget. Bear in mind that I have no idea how or when you are writing data.

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    i did something different now but still thx!

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 296 Most Valuable Professional

#2
11manish Profile Picture

11manish 224

#3
Valantis Profile Picture

Valantis 181

Last 30 days Overall leaderboard