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 / Problem count up and d...
Power Apps
Answered

Problem count up and down by one with Patch and Checkbox

(0) ShareShare
ReportReport
Posted on by 16

Hi everybody,

i'm currently trying for an app to bring up or down a counter of the participants in a sharepoint list (depending on the status of the checkbox). My problem is, i can get the counter up by one but the checkbox jumps directly back to unchecked (counter does not go down again). Which other approach could I use here. The reservation itself is written into another SharePoint list and not into the list with the visible sports units

HendrikKl_0-1600160272393.png

 

Categories:
  • Verified answer
    v-bofeng-msft Profile Picture
    Microsoft Employee on at

    Hi @HendrikKl :

    Could you tell me:

    • What is the gallery's items properyt?Is it 'sport'?(I assume it is sport)

    Firstly,let me explain why the checkbox jumped directly back to unchecked.

    The point is the checkbox's selection is not saved.When the data of the data source is changed, the Gallery including the controls in the Gallery will be reset. If you do not save the value of the checkbox, it will be reset to the state of UnCheck.

    Secondly,Please try this solution:

    1\Set the CheckBox's OnCheck property to:

    Collect(TeilnehmerList,ThisItem);

    Collect(Selections,{ID:ThisItem.ID,Selection:true}); /*Selections is my custom collection*/

    Patch(sport,(LookUp(sport,ID=ThisItem.ID)),{'Teilnehmer Anzahl':ThisItem.'Teilnehmer Anzahl'+1});

    2\Set the CheckBox's OnUncheck property to:

    Remove(TeilnehmerList,ThisItem);

    Remove(Selections,{ID:ThisItem.ID,Selection:true});

    Patch(sport,(LookUp(sport,ID=ThisItem.ID)),{'Teilnehmer Anzahl':ThisItem.'Teilnehmer Anzahl'-1});

    3\Set the CheckBox's Default property to:

    LookUp(Selections,ID=ThisItem.ID).Selection

    17.gif

    Best Regards,

    Bof

  • HendrikKl Profile Picture
    16 on at

    Thanks a lot 🙂

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

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 220 Super User 2026 Season 2

#2
WarrenBelz Profile Picture

WarrenBelz 189 Most Valuable Professional

#3
Mohsin Ali Profile Picture

Mohsin Ali 139

Last 30 days Overall leaderboard