I want to make "m:m selection pattern" between two records in a CDS data source in a Canvas App using two galleries.
When selecting a record in the first gallery, the second gallery is loaded with "all relevant records" and using a toggle, the m:m is either true (if an exiting m:m exists) or false (if no m:m exist). This works fine and I can now relate or unrelate by switching the toggle.
Sometime the number of rows in the second gallery is large, and I added a filter on the second gallery to make selection easier. I now find some inconsistencies when filtering. Most of the time it works, but sometimes if I filter so the first record is true, and after that I do a new filter so the first row is false, it will fire the onCheck event (and never the onUncheck???) and set it to true. Sometimes only for the first row, but sometimes for all rows. This is really weird. I tried using the exact same events/formulas on a CheckBox and it works flawlessly.
I have made a recording of the issue. In the app I have made a toggle, that disables/enables the toggle in the gallery, so first I show that I cant trigger the error with checkbox, but the error comes with the Toggle.
The formulas used on both CheckBox and Toggle are:
default: !IsBlank(LookUp(selectedOrgTeam.SecurityGroups, SecurityGroup = ThisItem.SecurityGroup, SecurityGroup))
onCheck: If(boolUseToggle, Relate(selectedOrgTeam.SecurityGroups, ThisItem);Set(selectedOrgTeam, selectedOrgTeam), false)
onUnCheck: Unrelate(selectedOrgTeam.SecurityGroups, ThisItem);Set(selectedOrgTeam, selectedOrgTeam)
I have tried to completely rewrite the logic, so all galleries are based on collections in stead of the CDS data source, and then do all the true/false logic in the collection, to have full control of "loading sequence", but the error is still occurring.
Any ideas what to do?
@HemantG thanks for pointing me to this forum, although this is not really a "pro dev" issue. 🙂
the solution (two custom entities with m:m) and the canvas app. If anyone want to try to reproduce.
WarrenBelz
109
Most Valuable Professional
Michael E. Gernaey
82
Super User 2025 Season 1
MS.Ragavendar
72