So I am trying to only display, on the load screen and onSelect of button of Active Leads 2 of 4 of my status types but I need it to load all 4 as the 2 I don't want displayed initially are pulled up through a tab button.
I have this so far which displays all of my status types, Not Started, In Progress, Dead Deal and Completed Deal
Sort( Filter( If( !IsEmpty( Filter( Administrators, FullName = varUser ) ), Lead_Data, Filter( Lead_Data, AssignedTo.Value = varUser || LeadMember1.Value = varUser || LeadMember2.Value = varUser || LeadMember3.Value = varUser || LeadMember4.Value = varUser ) ), If( SelectedStatus = "All", true, Status.Value in SelectedStatus ) ), "Created", If( SortByDate, Ascending, Descending ) )
I have tried to set my Show all Active button to Set(SelectedStatus, ["Not Started","In Progress"]).
I am so lost as I have been going in circles on this that I am not even sure I have all the important information here. I am hoping someone can help me! Thanks in advance!
Sorry I left out the most important part! 😅
If the changes I suggested are working, then the next thing to do is revise the second condition.
Currently what you have means, "If the SelectedStatus flag is "All", show everything; otherwise, show the matching status."
If( SelectedStatus = "All", true, Status.Value = SelectedStatus )
To achieve showing either progress, you can add another case in your if:
If( SelectedStatus = "All", true, [active leads tab is selected], Or(Status.Value = "In Progress", Status.Value = "Not Started"), Status.Value = SelectedStatus )
This means, "If the SelectedStatus flag is set to "All" show everything. If not, go to the next condition that checks if the Active Leads tab is selected. If so, then show the status matching In Progress or Not Started. Else show the one matching status.
So what you need to determine is how does the app know when the Active Leads tab is selected. Are you already using a variable to determine that state? For instance, OnSelect of that tab, do you have a Set statement for a variable for knowing that the tab had been clicked? If so, you can stick a variable there.
@Mr-Dang-MSFT Thank you! I really appreciate your time in showing me how to simplify what I have done! Shortening my If statement is very clever. I did change what I have to your suggestions as I am always looking to improve!
The thing I don't understand how to wrap my head around still is how to get my dashboard gallery to be displaying only 2 of 4 status types onVisible/Start as well as when the Show Active Leads button is clicked. I want it to load all of them but only display 2 of 4 of them. I only want to see Dead and Current Deals when I click on their tabs. Or maybe I am missing something all together.
Updating my understanding:
Set(SelectedStatus, "Not Started");
Set(SelectedStatus, "In Progress");
Set(SelectedStatus, "Dead Deal");
Set(SelectedStatus, "Completed Deal");
It looks like SelectedStatus is text from what you have shared. In this case, we can keep things consistent across other formulas you have:
If( SelectedStatus = "All", true, Status.Value = SelectedStatus )
or shortened:
Or( SelectedStatus = "All", Status.Value = SelectedStatus )
Next, let's simplify a few parts to improve performance.
The part where you check if someone is an administrator is used twice. Let's store that in a variable on start of the app so you don't need to call it again. I'll be referring to it as varAdmin.
Set(varAdmin, !IsEmpty( Filter( Administrators, FullName = varUser ) ) )
Confirm that this part works so far:
If( varAdmin, Lead_Data, Filter( Lead_Data, AssignedTo.Value = varUser || LeadMember1.Value = varUser || LeadMember2.Value = varUser || LeadMember3.Value = varUser || LeadMember4.Value = varUser ) )
In your gallery, you wrap Filter() around Filter().
Filter(Filter())
That may cause perf issues as one filter needs to be completed entirely before the next can begin. Let's place multiple conditions in the individual filters.
Multiple patterns--it's your choice.
Filter(datasource, condition1 && condition2) Filter(datasource, And(condition1,condition2)) Filter(datasource, condition1, condition2)
Below I merged the second condition. It's true that you would be repeating it, but it should work better. Confirm this is appearing the way you intend.
If( varAdmin, Filter( Lead_Data, Or( SelectedStatus = "All", Status.Value = SelectedStatus ) ), Filter( Lead_Data, AssignedTo.Value = varUser || LeadMember1.Value = varUser || LeadMember2.Value = varUser || LeadMember3.Value = varUser || LeadMember4.Value = varUser, Or( SelectedStatus = "All", Status.Value = SelectedStatus ) ) )
If so, append the Sort(). If it doesn't appear the way you expect, it may be the condition.
@Mr-Dang-MSFT thank you for your response.
So I am setting my variables on loading the app as the below so that I can push my tab buttons to change the gallery view to just one of these items:
Set(SelectedStatus, "Not Started"); Set(SelectedStatus, "In Progress"); Set(SelectedStatus, "Dead Deal"); Set(SelectedStatus, "Completed Deal");
Then when I show the dashboard page (onVisible) I have this as shown below so that it will load the screen as I desire (however it is not loading as I desire right now):
// Collect data for the pie chart on dashboard screen If(!IsEmpty(Filter(Administrators,FullName=varUser)), ClearCollect(colDash_StatusTrack,{Status:"Not Started",Count:CountIf(Lead_Data,Status.Value="Not Started")}); Collect(colDash_StatusTrack,{Status:"In Progress",Count:CountIf(Lead_Data,Status.Value="In Progress")}); //Collect(colDash_StatusTrack,{Status:"Dead Deal",Count:CountIf(Lead_Data,Status.Value="Dead Deal")}); Collect(colDash_StatusTrack,{Status:"Completed Deal",Count:CountIf(Lead_Data,Status.Value="Completed Deal")}), ClearCollect(colDash_StatusTrack,{Status:"Not Started",Count:CountIf(Lead_Data,Status.Value="Not Started"&&Or(AssignedTo.Value=varUser,LeadMember1.Value=varUser,LeadMember2.Value=varUser,LeadMember3.Value=varUser))}); Collect(colDash_StatusTrack,{Status:"In Progress",Count:CountIf(Lead_Data,Status.Value="In Progress"&&Or(AssignedTo.Value=varUser,LeadMember1.Value=varUser,LeadMember2.Value=varUser,LeadMember3.Value=varUser))}); //Collect(colDash_StatusTrack,{Status:"Dead Deal",Count:CountIf(Lead_Data,Status.Value="Dead Deal"&&Or(AssignedTo.Value=varUser,LeadMember1.Value=varUser,LeadMember2.Value=varUser,LeadMember3.Value=varUser))}); Collect(colDash_StatusTrack,{Status:"Completed Deal",Count:CountIf(Lead_Data,Status.Value="Completed Deal"&&Or(AssignedTo.Value=varUser,LeadMember1.Value=varUser,LeadMember2.Value=varUser,LeadMember3.Value=varUser))}) ); // Collect Not Started & In Progress :::::: ACTIVE DEALS :::::: ClearCollect(colDash_ActiveDeals, Filter(Lead_Data,Status.Value="Not Started")); Collect(colDash_ActiveDeals, Filter(Lead_Data,Status.Value="In Progress")); // Collect Dead Deals :::::: DEAD DEALS :::::: ClearCollect(colDash_DeadDeals, Filter(Lead_Data,Status.Value="Dead Deal")); // Collect Completed Deals :::::: COMPLETED DEALS :::::: ClearCollect(colDash_CompletedDeals, Filter(Lead_Data,Status.Value="Completed Deal")); // Allow sort by date to work Set(SortByDate,true); // Have all data show on load of page Set(SelectedStatus, "All");
As previously mentioned and with your guidance I have my gallery Items set to
Sort( Filter( If( !IsEmpty( Filter( Administrators, FullName = varUser ) ), Lead_Data, Filter( Lead_Data, AssignedTo.Value = varUser || LeadMember1.Value = varUser || LeadMember2.Value = varUser || LeadMember3.Value = varUser || LeadMember4.Value = varUser ) ), If( "All" in SelectedStatus, //SelectedStatus = "All", true, Status.Value in SelectedStatus ) ), "Created", If( SortByDate, Ascending, Descending ) )
And each one of my tabs (using "Not Started" as the example):
Set(SelectedStatus, "Not Started")
What I am trying to accomplish is that when I load the dashboard screen just Not Started and In Progress status rows display and when the user selects the Active Leads tab that currently is set to show all it will also only show Not Started and In Progress. This is where my confusion is coming in.
If I understand correctly, you want to filter down status types under different conditions. It appears you have two layers of filtering.
Filter 1: Filter leads by admin vs. not admin
Filter 2: show all or some statuses.
Filter 1 looks okay. To get Filter 2 correct, it's a matter of data types.
Your current formula sets SelectedStatus as a table.
Set(SelectedStatus, ["Not Started","In Progress"])
But your condition attempts to match that table against text ("All").
If( SelectedStatus = "All", true, Status.Value in SelectedStatus )
There's a few different ways of getting both sides of the condition to be the same. Here's one way:
"All" in SelectedStatus.ValueNote that SelectedStatus in the way you have declared it using square brackets [] generates a one column table called "Value". So this condition searches for the text "All" in the Value column of the SelectedStatus table.
PS: When using Sort() you do not use "" around the names of columns; only SortByColumns needs quotation marks.
@KimberlyM wrote:
So I am trying to only display, on the load screen and onSelect of button of Active Leads 2 of 4 of my status types but I need it to load all 4 as the 2 I don't want displayed initially are pulled up through a tab button.
I have this so far which displays all of my status types, Not Started, In Progress, Dead Deal and Completed DealSort( Filter( If( !IsEmpty( Filter( Administrators, FullName = varUser ) ), Lead_Data, Filter( Lead_Data, AssignedTo.Value = varUser || LeadMember1.Value = varUser || LeadMember2.Value = varUser || LeadMember3.Value = varUser || LeadMember4.Value = varUser ) ), If( SelectedStatus = "All", true, Status.Value in SelectedStatus ) ), "Created", If( SortByDate, Ascending, Descending ) )
WarrenBelz
146,731
Most Valuable Professional
RandyHayes
76,287
Super User 2024 Season 1
Pstork1
66,079
Most Valuable Professional