cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Frequent Visitor

Problem count up and down by one with Patch and Checkbox

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

 

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Community Support
Community Support

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

View solution in original post

2 REPLIES 2
Highlighted
Community Support
Community Support

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

View solution in original post

Highlighted

Thanks a lot 🙂

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

News & Announcements

Community Blog

Stay up tp date on the latest blogs and activities in the community News & Announcements.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Community Highlights

Community Highlights

Check out the Power Platform Community Highlights

Top Solution Authors
Top Kudoed Authors
Users online (16,327)