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