Hi there,
This seems to be an issue that's popped up before but I haven't found a solution that I can apply to my case (it may be that one does not exist!)
So fairly simple setup in a collection called summarypackage:
UnitId | RequiredFg |
1 | 0 |
2 | 1 |
3 | 0 |
4 | 1 |
5 | 1 |
Collection returning in a Gallery, with the UnitId in Column 1 and a Toggle in Column 2.
I set the OnCheck value to:
Patch(summarypackage,LookUp(summarypackage, UnitId = ThisItem.UnitId),{RequiredFg: 1}),
And the OnUnCheck value to:
Patch(summarypackage,LookUp(summarypackage, UnitId = ThisItem.UnitId),{RequiredFg: 0})
The issue that occurs is that while initially the Toggle will reflect the patch, it then refuses to toggle on, even though the patch is successful (see attached)
Seems the same issue was discussed here however I cannot get a solution to work.
Trying and If() statement on the OnChange didn't work, e.g.
If(RequiredCheck.Value=true,Patch(summarypackage,LookUp(summarypackage, UnitId = ThisItem.UnitId),{RequiredFg: 1}),Patch(summarypackage,LookUp(summarypackage, UnitId = ThisItem.UnitId),{RequiredFg: 0}));
And setting a Default value to read from the Collection just created an infinite loop (I guess because Patch would apply, field would read that value had changed, so switch toggle, which would reapply the patch etc etc)
If anyone is able to help with a workaround to get the toggle to function correctly it'd help a lot!
I've managed to get a working version with a Radio Select but a Toggle would be preferable (if I can get it to work!)
Thanks in advance for any help you can give,
R
Solved! Go to Solution.
Just in case anyone else comes across this issue.
There doesn't appear to be an actual fix for the toggle bug but you can make a button function like a toggle in a gallery:
Add Button, then in OnSelect property to update collection, add the following :
(This will check value in collection and apply opposite value when user clicks button)
If(LookUp('collectionname', Id = ThisItem.Id).RequiredFg = 1, Patch('colletionname',LookUp('collectionname', Id= ThisItem.Id),{RequiredFg: 0}),Patch('collectionname',LookUp('collectionname', Id= ThisItem.Id),{RequiredFg: 1}))
Then in the Fill value of the Button, check the Collection to see what value there is and apply color accordingly:
If(LookUp('collectionname', Id= ThisItem.UnitId).RequiredFg = 1, ColorValue("#FFFFFF"), ColorValue("#000000"))
This will function like a Toggle and appear to the user to have 'Clicked' and 'UnClicked' status, so behaviorally works like a toggle too!
Hope this helps someone 🙂
Just in case anyone else comes across this issue.
There doesn't appear to be an actual fix for the toggle bug but you can make a button function like a toggle in a gallery:
Add Button, then in OnSelect property to update collection, add the following :
(This will check value in collection and apply opposite value when user clicks button)
If(LookUp('collectionname', Id = ThisItem.Id).RequiredFg = 1, Patch('colletionname',LookUp('collectionname', Id= ThisItem.Id),{RequiredFg: 0}),Patch('collectionname',LookUp('collectionname', Id= ThisItem.Id),{RequiredFg: 1}))
Then in the Fill value of the Button, check the Collection to see what value there is and apply color accordingly:
If(LookUp('collectionname', Id= ThisItem.UnitId).RequiredFg = 1, ColorValue("#FFFFFF"), ColorValue("#000000"))
This will function like a Toggle and appear to the user to have 'Clicked' and 'UnClicked' status, so behaviorally works like a toggle too!
Hope this helps someone 🙂
The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.
This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.
User | Count |
---|---|
184 | |
45 | |
45 | |
34 | |
34 |
User | Count |
---|---|
257 | |
82 | |
78 | |
67 | |
65 |