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

Month Year display

Drop Down : Items : Distinct(Sort('[dbo].[Table]',MonthColumn),MonthColumn)
Gallery:Items : Filter('[dbo].[Table]',MonthColumn=Dropdown1.Selected.Result)

I am currently able to display Gallery values based on the dropdown selection.
How do I display all values in the gallery by default i.e have a empty default selection(like null or select all option) in the dropdown and the entire list of records should be displayed in the gallery. And ofcourse then based on dropdown selected only those records are displayed in the gallery.

My drop down currently has values like April 2018 August 2017 August 2018 October 2017 etc...
How do I order by drop down list in the descending order with the most recent month year appearing first.
The month column in the sqlserver database is varchar.
Thanks
Thanks

1 REPLY 1
Highlighted
BenFetters
Level 8

Re: Month Year display

Hi,

 

I have an idea that hopefully can help...

 

What I would maybe try is having the OnVisible property on your screen collect your data that you currently have in the drop down with something like: ClearCollect(CollectionName, DataSource). Then you can add after that something like: Collect(CollectionName, {Title:"All Items"}). In other words, the OnVisible property of your screen would be something like: ClearCollect(colTable, '[dbo].[Table]'.Title);Collect(colTable, {Title:"All Items"})

 

For the Drop Down control under the items property you can put something like: SortByColumns(colTable.Title,"Title",Ascending). This will put the "All Items" selection at the top. 

 

Finally, for the gallery under the Items property you can filter it based on the drop down and put something like: if(Dropdown1.Selected.Result = "All Items", '[dbo].[Table]', Filter('[dbo].[Table]',MonthColumn=Dropdown1.Selected.Result))

 

Hopefully that makes sense and will work! 

 

Kind Regards,

 

Ben

Helpful resources

Announcements
firstImage

Watch Sessions On Demand!

Continue your learning in our online communities.

SecondImage

PowerApps Monthly Community Call

Next Wednesday, September 18th at 8am PDT

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

FirstImage

Power Platform World Tour

Coming to a city near you

thirdimage

PowerApps Community User Group Member Badge

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

FourthImage

Join PowerApps User Group!!

Connect, share, and learn with your peers year-round

SecondImage

Power Platform Summit North America

Register by September 5 to save $200

Users Online
Currently online: 272 members 4,781 guests
Please welcome our newest community members: