cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
BrendanZ1
Helper V
Helper V

Setting a dropdown default value that filters a gallery

Hi - I have a gallery that currently has two dropdowns for filtering.

1.Approval Status

2. Job Status

 

Both of these are based on collections using data from their own separate SP lists.

 

I have everything working, with exception of getting the ApprovalStatus dropdown, to always have "Approved" as the selection.

The idea being that workers don't need to see tasks that haven't been approved for scheduling (basically requests that have been rejected in the first stage of the request process).

 

I have tried changing the 'Default' value for the dropdown to "Approved", but it resets to "All" each time I leave the screen and come back. I have tried an onVisible so that the dropdown selects "Approved", but this doesn't work also.

 

The selection options in the Approval Status list are:

-

Approved

Rejected

Deferred

 

I use a ClearCollect to bring the 'All' option in.

 

If working correctly, when staff look at current tasks, they will see all tasks that have been approved. They can then filter this list based on job status. 

 

Thanks

1 ACCEPTED SOLUTION

Accepted Solutions

What is the Items property of the dropdown for approval status?

One simple resolution is to populate your collection with "Approved" as the first value. If that's not ideal, try this as the default value:

Assuming approvalStatusColl is the collection name:
LookUp(approvalStatusColl, Value = "Approved")

Another option is to use a combo box but we will get to that only if needed.

Let me know if this helps.

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

Thanks!
Hardit Bhatia
The Power Addict
https://thepoweraddict.com

View solution in original post

5 REPLIES 5
Drrickryp
Super User
Super User

Hi @BrendanZ1 

Could you please post the Items property of your gallery?

Yep @Drrickryp  no worries;

 

If(ddApprovalStatus.Selected.AprrovalStatus = "All" And JobStatusDropDown.Selected.JobStatus = "All", WorkOrderList,
JobStatusDropDown.Selected.JobStatus ="All" And ddApprovalStatus.Selected.AprrovalStatus <> "All",
Filter(WorkOrderList, ApprovalStatus = ddApprovalStatus.Selected.AprrovalStatus),
JobStatusDropDown.Selected.JobStatus <> "All" And ddApprovalStatus.Selected.AprrovalStatus <> "All",
Filter(WorkOrderList, ApprovalStatus = ddApprovalStatus.Selected.AprrovalStatus And JobStatus = JobStatusDropDown.Selected.JobStatus)
)

 

While this is enabling choice for the ApprovalStatus dropdown, I want it set to approved only. If there is another way to do this without using a dropdown, I am open to that suggestion too.

What is the Items property of the dropdown for approval status?

One simple resolution is to populate your collection with "Approved" as the first value. If that's not ideal, try this as the default value:

Assuming approvalStatusColl is the collection name:
LookUp(approvalStatusColl, Value = "Approved")

Another option is to use a combo box but we will get to that only if needed.

Let me know if this helps.

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

Thanks!
Hardit Bhatia
The Power Addict
https://thepoweraddict.com

Thanks @PowerAddict  while it isn't ideal, I have changed the collection to grab "Approved" first. It isn't a big deal though as the dropdown will be hidden anyway.

 

Incidentally, the LookUp option didn't seem to want to work.

 

Thanks again

Awesome! Glad I could help! Good luck with the rest of your app! Feel free to reach out in case of any questions!

Side note: Can you please share the error you were getting with the LookUp function?

Thanks,
Hardit Bhatia
The Power Addict
https://thepoweraddict.com

Helpful resources

Announcements
Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Community Call Conversations

Introducing the Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Top Kudoed Authors
Users online (1,685)