Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Apps - Building Power Apps
Unanswered

OnChange not firing

(0) ShareShare
ReportReport
Posted on by 345

Hi there,

 

I have an OnChange function on a text input (# Students) that is designed to update all records in a gallery (# Stud.) when the number is changed. While i was using a SharePoint list as my database, it worked great, but now that I've moved over to an SQL DB, it doesn't seem to be firing when changed.

 

Capture

 

UpdateContext(
 {newStudents:
 'UE - Value - # Students'.Text}
);
ForAll(
 'UE Unit Gal'.AllItems,
 Patch(
 '[dbo].[Units]',
 LookUp(
 '[dbo].[Units]',
 ID = Value('UE Gal ID'.Text)
 ),
 {
 'Number_x0020_of_x0020_Students': Value(newStudents)
 }
 )
)

The offending input is the one with the delegation error. If anyone can help me remove that as well, I'd be very grateful! 

  • EpicTriffid Profile Picture
    345 on at
    Re: OnChange not firing

    Hi @yashag2255 ,

     

    Thanks for the help. I adapted it as you said, and no errors that I can see. The notifation does come through, so do you have ideas what might be wrong with the Patch? Is there a problem between ForAll and SQL?

  • yashag2255 Profile Picture
    24,442 Super User 2024 Season 1 on at
    Re: OnChange not firing

    Hey @EpicTriffid 

     

    Can you try to update the expression as:

    UpdateContext(
        {newStudents:
        Value('UE - Value - # Students'.Text)}
    );
    ForAll(
        'UE Unit Gal'.AllItems,
        Patch(
            '[dbo].[Units]',
            LookUp(
                '[dbo].[Units]',
                ID = Value('UE Gal ID'.Text)
            ),
            {
                'Number_x0020_of_x0020_Students': newStudents
            }
        )
    )
    Are you getting any errors? To check if the OnChange is getting triggered, add the below expression on the OnChange property as:
    Notify("Getting triggered");
    If you are able to see the notification, then the issue is with the Patch query and OnChange is getting triggered.
     
    Note: OnChange only gets triggered if the user clicks outside the text input. 
     
    Hope this Helps!
     
    If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

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

🌸 Community Spring Festival 2025 Challenge 🌸

WIN Power Platform Community Conference 2025 tickets!

Markus Franz – Community Spotlight

We are honored to recognize Markus Franz as our April 2025 Community…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 146,651 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 65,999 Most Valuable Professional

Leaderboard