Can a Toggle default be dynamic, based on multiple conditions in a List?
I have a free floating Toggle (Active/Inactive) on my screen
I have a Member List and a Member Training List
Each Member appears once on the Member List, and as many times as they have training certificates on the Member Training List
The Toggle is currently set to Default to the Member's current status (Active/Inactive) based on their status on the Member List
Gallery3 is populating data from the Member Training List, including Compliance Status (which can contain 'Certified', 'Compliant', 'Noncompliant' for each training obtained by the Member.
What I'd like is once all collections fire and everything loads if ANY of the Training that appears in Gallery3 shows a Compliance Status of "Noncompliant", the Toggle control shall automatically default to "Inactive" (or 'false') position.
Set the default property of the toggle to something like this:
!(ThisItem.'Compliance Status'.Value = "Noncompliant")
The result is:
Let me know if this helps.
---
If you like this reply, please give kudos (Thumbs Up). And if this solves your problem, please mark this reply as a solution by selecting Accept as Solution. This makes it easier for others to find answers to similar questions.
Thanks!
Hardit Bhatia
Microsoft Business Applications MVP
The Toggle is free-floating and not set within a Gallery.
There is a Member name Dropdown
List: Member List (Source of Dropdown data, Toggle Status, and Gallery 1 data)
Member Training List (Source of Gallery 2 data)
There are two Galleries. Gallery 1 and Gallery 2.
Gallery 1 has base park and Member data. Gallery 2 contains Member Certs-Quals data.
The Toggle is currently set to default to 'Active' if Gallery 1: Company Member shows 'Yes'.
I would prefer -
1. When the dropdown changes an analysis of the Member List is initiated
2. The analysis shall look at the Compliance Status (a column in the Member List) of all Certs-Quals Titles associated with the Member selected in the dropdown
3. If the Compliance Status of any of those Certs-Quals equals 'Noncompliant' the Toggle control shall default to 'Inactive'
4. The User shall not be able to set the Toggle from 'Inactive' to 'Active' until all 'Noncompliant' conditions have been corrected.
Got it, thanks a lot for the details.
So here is my setup:
I have the following expressions/formulas:
Gallery items property (this will differ for you but should be similar):
Filter('Student Scores', Title = ComboBox6.Selected.Result)
The default property of the toggle is set to:
CountRows(Gallery3.AllItems) = CountRows(Filter(Gallery3.AllItems, 'Compliance Status'.Value = "Compliant" || 'Compliance Status'.Value = "Certified"))
Basically the left side of the equation counts the total number of rows in the filtered gallery. The right side of the equation counts the number of rows in the filtered gallery for which the status is either compliant or certified. If the two values are equal, that will mean that there are no courses that have a status of noncompliant.
The DisplayMode of the toggle is set to
DisplayMode.Disabled
Here is a small video:
Let me know if this helps.
---
If you like this reply, please give kudos (Thumbs Up). And if this solves your problem, please mark this reply as a solution by selecting Accept as Solution. This makes it easier for others to find answers to similar questions.
Thanks!
Hardit Bhatia
Microsoft Business Applications MVP
Blog | Twitter | LinkedIn | Facebook | YouTube | Email
You are so kind to work so hard even though I've given you little reason to believe I know what I'm doing. 🤣🤣🤣
I understand all you've just relayed.
If I may; it appears you solution has the Toggle incorporated into the Gallery, with one Toggle per Title.
This is not how my Gallery is formatted. Are you saying I have to reconfigure my Gallery?
Will your solution not work on my screen/Gallery currently formatted?
You have one toggle per Title. I have one Toggle for all Titles; I don't follow the logic in that case.
Also, the end User doesn't want the Toggle disabled. They want the color and what it indicates.
I've solved that problem by creating an image of the Toggle in "Inactive" status and coded it to appear or disappear over the Toggle when the Member is 'Noncompliant'.
I thought you didn't want the user to be able to change the toggle, that's why I suggested the DisplayMode. But as long as you have solved your problem, that's great!
---
If you like this reply, please give kudos (Thumbs Up). And if this solves your problem, please mark this reply as a solution by selecting Accept as Solution. This makes it easier for others to find answers to similar questions.
Thanks!
Hardit Bhatia
Microsoft Business Applications MVP
Ok, its looks we have progress. The Toggle is responding the CountRows and default as per the default List setting of the Status column for the Member in the Dropdown.
Now, I currently have on the Toggle Control:
Default:
CountRows(ECMmbrCQSmryGallery.AllItems) = CountRows(Filter(ECMmbrCQSmryGallery.AllItems, HiddenLookupComplianceFormulaLabel.Text = "Compliant" || HiddenLookupComplianceFormulaLabel.Text = "Certified"))
OnCheck:
Patch(
MmbrList,
LookUp(MmbrList,FullNm=MmbrFullNmDD.Selected.FullNm),
{
ActvMem: "Yes"
}
)
UnCheck:
Patch(
MmbrList,
LookUp(MmbrList,FullNm=MmbrFullNmDD.Selected.FullNm),
{
ActvMem: "No"
}
)
NOW...I need the User to be able to for normal administrative reasons, be able to 'manually' move the Toggle from 'Active' to 'Inactive' even though the Member is 'Compliant' with all Certs/Quals.
The Status of the Member should default to 'Inactive' automatically through the fix above anytime the Member has a Cert/Qual that is 'Noncompliant' (which is now working). Also, the ability to override the Toggle setting manually, moving the Member from 'Active to Inactive' or 'Inactive to Active' as issue NOT having to do with compliance dictate.
Check out new user group experience and if you are a leader please create your group
Did you miss the call?? Check out the Power Apps Community Call here!
See the latest Power Apps innovations, updates, and demos from the Microsoft Business Applications Launch Event.
User | Count |
---|---|
257 | |
239 | |
83 | |
36 | |
27 |
User | Count |
---|---|
309 | |
268 | |
121 | |
69 | |
46 |