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

Bug: When using Toggle control to patch a collection toggle control does not respond or resets all other toggle controls in a gallery.

Hello,

 

While building an app, I wanted to use a toggle control to write a value in a text label back to a collection. I am using Patch to update the collection. The collection is currently being displayed in a gallery. When selecting the toggle and using the OnCheck Property to initiate the patch the toggle looks as if it wants to slide to the right but nothing happens on the screen. When I check the Collection I can see that the data was written to the collection. If you click the same toggle again it will then show as active and move to the right. This happens for every toggle used in the collection. I also found a similar issue using the checkbox control. 

 

This is what I am using OnCheck.

 

Patch(RequiresPPECollection,ReviewGallery.Selected,{Date0: Today_Label.Text})

 

I am trying to come up with a workaround in the meantime. 

 

Using collect to write the data to a new collection works fine. It seems to only happen when Patch is used. 

9 REPLIES 9
Highlighted
Community Champion
Community Champion

Re: Bug: When using Toggle control to patch a collection toggle control does not respond or resets all other toggle controls in a gallery.

Hi @pes10350 ,

I was involved with the same issue a short while ago - possible solution and explanation is at the top of this post.

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

Highlighted
Community Support
Community Support

Re: Bug: When using Toggle control to patch a collection toggle control does not respond or resets all other toggle controls in a gallery.

Hi @pes10350 ,

Do you mean that using this formula to update successfully?

Patch(RequiresPPECollection,ReviewGallery.Selected,{Date0: Today_Label.Text})

I suggest you not use  "ReviewGallery.Selected" to represent the item that you want to update.

"ReviewGallery.Selected" will return an item not only with the fields of the collection, but also the control value inside the gallery, like Separatorvalue.

You could save this as a collection to see.

ClearCollect(collection1,ReviewGallery.Selected)

 

To solve this problem, I suggest you use LookUp/Filter to filter data from data source based on gallery.Selected.

Could you tell me the unique field in your collection?

I assume that it is the ID field.

Try this:

Patch(RequiresPPECollection,LookUp(RequiresPPECollection,ID=ReviewGallery.Selected.ID),{Date0: Today_Label.Text})

You could also replace ID with other field name.

 

 

Best regards,

Community Support Team _ Phoebe Liu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Highlighted
Frequent Visitor

Re: Bug: When using Toggle control to patch a collection toggle control does not respond or resets all other toggle controls in a gallery.

Hi @v-yutliu-msft ,

 

I tried the formula you specified and the controls function in the same way they do when I had my original formula. The first time selecting the toggle does nothing on the screen to the toggle control but collects the data. Second Time selecting the toggle show the toggle as selected and slid to the right. If I select another toggle in another gallery item it resets all toggles on the screen. I am not sure if  I mentioned but the gallery in question shows the items in the collection I am saving data back to. not sure if that could be causing an issue. Not sure if I should collect the toggles in another collection and merge them? I have been trying to do so but have had no luck at this point.

Highlighted
Community Support
Community Support

Re: Bug: When using Toggle control to patch a collection toggle control does not respond or resets all other toggle controls in a gallery.

Hi @pes10350 ,

Do you mean that if you select other toggles, the selection of previous toggle will be clear?

If so, I suggest you save all the selections in a collection, then filter based on this collection to update.

For example, set the toggle's OnCheck:

Collect(collection1,ReviewGallery.Selected)

add a submit button, set its OnSelect:

ForAll(collection1,
Patch(RequiresPPECollection,LookUp(RequiresPPECollection,ID=[@collection1]ID),{Date0: Today_Label.Text})
)

 

If my understanding is not right, I suggest you describe with screen shoots to help me understand your issue.

 

 

Best regards,

Community Support Team _ Phoebe Liu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Highlighted
Frequent Visitor

Re: Bug: When using Toggle control to patch a collection toggle control does not respond or resets all other toggle controls in a gallery.

Hi @v-yutliu-msft ,

 

I attempted what you listed above. Unfortunately, it is not capturing everything.  Let me describe what we are aiming to do. I am collecting a list of staff on an early screen. Once the user selects needs PPE. The staff member information is saved to a collection. On the  review screen we have 7 toggles set up that have labels that dynamically change the date and day of the week. The gallery on the review screen displays the collection of staff from an earlier screen. When the user selects a toggle I would like to store the date value to the collection. OnSubmit of a button I patch all the information to a new SharePoint list.  I am attaching screen shots below.

 

Unique is the StaffID which is their employee number in out HR system.

 

Staff and Staff data is collected in RequiresPPECollection.

 

I forgot to mention. Yes, with your initial solution, when I select the toggles they will not respond in screen. If I select them again they will respond. If I select a uncheck a marked toggle all toggles on the screen are reset.

 

Thank you for all your help!

Highlighted
Community Support
Community Support

Re: Bug: When using Toggle control to patch a collection toggle control does not respond or resets all other toggle controls in a gallery.

Hi @pes10350 ,

I think I know what you mean.

If the toggle set OnCheck to patch function, it will not act when clicking the first time and will make other toggles reset.

Am I right?

Just like this:

4242.gif

 If so, I've met the same problem.

I have reported this problem to our product team.

If there's any reply, I will leave message here.

 

 

Best regards,

Community Support Team _ Phoebe Liu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Highlighted
Frequent Visitor

Re: Bug: When using Toggle control to patch a collection toggle control does not respond or resets all other toggle controls in a gallery.

@v-yutliu-msft,

That is correct! I am trying to find the best way to work around this until it is corrected.

Thank you!
Highlighted
Community Support
Community Support

Re: Bug: When using Toggle control to patch a collection toggle control does not respond or resets all other toggle controls in a gallery.

Hi @pes10350 ,

As an alternative way, you could use the toggle's OnSelect to avoid OnCheck's problem.

For example, set the toggle's OnSelect:
If(Toggle1.Value=true,Patch(....))

 

When I receive any reply about this bug, I will inform you here.😀

 

 

Best regards,

Community Support Team _ Phoebe Liu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Highlighted
Frequent Visitor

Re: Bug: When using Toggle control to patch a collection toggle control does not respond or resets all other toggle controls in a gallery.

Hi @v-yutliu-msft ,

 

Thank you for all your help. I wanted to let you know I also tried the onselect method you mentioned above and the toggle functions in the same way. The first check looks as if it does nothing but does file in the item to the collection.

 

Thank you for bringing this to the team about the bug!

 

Helpful resources

Announcements
secondImage

Demo-Extravaganza 2020

Check out these cool Power Apps & vote on your favorite!

secondImage

Robotic Process Automation

Let's talk about the solution provided by Microsoft for Robotic Process Automation (RPA)

secondImage

Community Highlights

Check out whats happening in Power Apps

secondImage

Community User Group Member Badges

FIll out a quick form to claim your community user group member badge today!

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (6,336)