cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
KevinHardy
Level: Powered On

2 dropdown lists to filter gallery

I've attached a screenshot of my View Logs screen.

 

What I would like to achieve is using both Dropdowns to filter the Gallery.

Dropdown1 selects a name (Supported Person), Dropdown2 selects a shift period (Shift). Is this possible? If so, what are the formulas I need to place on the dropdowns and Gallery please.

1 ACCEPTED SOLUTION

Accepted Solutions
IvanZ
Level: Powered On

Re: 2 dropdown lists to filter gallery

I hate IE, gave me error and I have to retype it again. I reread your question, and there are few things you need to modify

 

1. In your "Daily log' sharepoint list (datebase), is there a column datecol which you convert the date to ddmmyyyy, or yyyymmdd format?( yyyymmdd is preferred)?If not, you need to do this first, or if your sp list will not going over 2000, then you can do addcolumn with collection to avoid physically create a column in SP datebase.

 

2. In powerapps, create a label, text=Text(datepicker1.selectedDates,"yyyymmdd"), now the text should be 20191116 when you play with datepicker1.

 

3. Create a height flexible gallery, in item=Filter('Daily logs',DateCol = text1.Text), it should now filter your gallery based on datepicker1 now.

 

4. Your shiftperiod dropdown is good, now in your gallery, selected all the parts (date, person, shift period, arrow, separator)  and choose "group", in the group's Visible property = If(Thisitem.shiftperiod = varFilter,true,false)

 

5. Now if you play it, it should filter based on datepicker1, and it will further hide the item based on shift dropdown.

View solution in original post

16 REPLIES 16
Dual Super User
Dual Super User

Re: 2 dropdown lists to filter gallery

Hey @KevinHardy 

 

Can you try to use the below expression on the Items property of the gallery control?

Filter(DataSourceName, 'Supported Person' = Dropdown1.Selected.Name && Shift = Dropdown2.Selected.Shift)

Here, you need to update the sample names with the actual names of the controls and attributes.

 

Hope this Helps!

 

If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

KevinHardy
Level: Powered On

Re: 2 dropdown lists to filter gallery

@yashag2255 

 

I get an 'Invalid argument type?

I had to adapt your formula to accommodate the actual names used in the app:

 

Filter('Daily Logs','Supported Person' = Dropdown_SPN.Selected.Name && 'Shift period' = Dropdown_Shift.Selected.Shift)

 

I interested as to why its Selected.Name and Selected.Shift as these are being underlined in squiggly red - Can it be Selected.{anything you like}?

Dual Super User
Dual Super User

Re: 2 dropdown lists to filter gallery

Hey @KevinHardy 

 

Selected.Name and Selected.Shift refers to the column that you want to extract from the Items in the Dropdown. So basically it is like, DropdownName.Selected.ColumnName

If you will just write "DropdownName.Selected.", the intellisense will suggest the appropriate column names.

 

Hope this Helps!

 

If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

KevinHardy
Level: Powered On

Re: 2 dropdown lists to filter gallery

@yashag2255 

 

Thank you for the explanation. That makes more sense now 🙂

Sadly I am still getting an invalid argument type.

 

The Sharepoint list is called 'Daily Logs'

The Columns are called 'Supported Person' and 'Shift period'

The Dropdowns are Dropdown_SPN and Dropdown_Shift

 

So (if I am understanding this correctly) the Gallery Item Property should be;

Filter('Daily Logs','Supported Person' = Dropdown_SPN,Selected.'Supported Person' && 'Shift Period' = Dropdown_Shift.Selected.'Shift period')

 

Which still has the invalid argument type?

v-siky-msft
Level 10

Re: 2 dropdown lists to filter gallery

Hi @KevinHardy ,

I guess you are almost getting the truth, however, you misused a comma in the formula, please modify to a '.' dot and check if you issue is fixed.

Snipaste_2019-11-14_11-04-46.png

If the error still remains, could you share the Items property of two dropdown?

It seems that these two field are complex type columns(Choices, Lookup). you can change to use Dropdown_SPN,Selected.Value  and Dropdown_Shift.Selected.Value.

Hope this can help.

Best regards,

Sik

If my post is helpful for you, please click on “Accept as Solution” to help other members find it more quickly.

KevinHardy
Level: Powered On

Re: 2 dropdown lists to filter gallery

Hi @v-siky-msft 

 

I fixed the error but still an invalid argument type.

 

I'm actually trying to use 3 items to filter the Gallery - I didn't include this in the original question as I thought it would over-complicate things, and that, once I understood what to do I would be able to sort it myself).

 

I've included some screen shots of the work in progress.

 

If I can get the gallery to filter in this way, there won't be any need to have an extra Detail screen as the user will be able to see the relevant info on the single gallery.

v-siky-msft
Level 10

Re: 2 dropdown lists to filter gallery

Hi  @KevinHardy ,

 

I get the point, you are using Distinct function in Support Person dropdown, so you need to use "Dropdown_SPN,Selected.Result" to call the selection.

Please modify your formula as below:

Filter('Daily Logs', 'Supported Person' = Dropdown_SPN,Selected.Result && 'Shift Period' = Dropdown_Shift.Selected.Shiftperiod)

If this doesn't work, please post back the error detail of formula.

Best regards,

Sik

KevinHardy
Level: Powered On

Re: 2 dropdown lists to filter gallery

@v-siky-msft 

 

I've attached a screenshot of the error. It appears to not like the '='?

 

I changed the column names to remove the spaces as I thought this may be causing some issues (now SupportedPerson and ShiftPeriod)

v-siky-msft
Level 10

Re: 2 dropdown lists to filter gallery

Hi @KevinHardy ,

 

I can't see the attachment of screenshot.

We need it.

Best regards,

Sik

Helpful resources

Announcements
thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

Top Kudoed Authors (Last 30 Days)
Users online (5,031)