cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
3csman
Impactful Individual
Impactful Individual

Toggle Default

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.

8 REPLIES 8
PowerAddict
Super User
Super User

Set the default property of the toggle to something like this: 

!(ThisItem.'Compliance Status'.Value = "Noncompliant")

The result is:

Compliance.PNG

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

3csman
Impactful Individual
Impactful Individual

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.

 

Capture.PNG

Got it, thanks a lot for the details. 

 

So here is my setup: 

  • I have a combo box of Students
  • I have a toggle outside the gallery
  • I have a gallery of courses for the selected student
  • As I select a student, I can see the filtered list of courses for the selected student
  • The logic I have for the toggle is if all the courses are either compliant or certified, the toggle will be set to true/on
  • If any of the courses for the selected student has a status of Noncompliant, the toggle will be set to false/off
  • In either case, the user cannot change the toggle
  • In the gallery, I added a label and a toggle just to show the status value for your reference

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: 

ToggleDefault.gif

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

 

3csman
Impactful Individual
Impactful Individual

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.

3csman
Impactful Individual
Impactful Individual

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

Blog | Twitter | LinkedIn | Facebook | YouTube  |  Email

Sorry just saw this message. My toggle is outside the gallery. The one inside the gallery can be ignored. That was from my previous example. I would suggest you use my approach rather than using an image to hide the toggle. Ignore the toggle thats inside the gallery and look at the one thats outside.

---
If you like this reply, please give kudos. And if this solves your problem, please accept this reply as the solution.

Thanks!
Hardit Bhatia
Microsoft Business Applications MVP
https://thepoweraddict.com
3csman
Impactful Individual
Impactful Individual

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.

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Microsoft Ignite 768x460.png

Find your focus

Explore the latest tools,training sessions,technical expertise, networking and more.

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Welcome Super Users.jpg

Super User Season 2

Congratulations, the new Super User Season 2 for 2021 has started!

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Users online (2,037)