cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
BuiDucNghia
Frequent Visitor

Filter events in Gallery by current date and selected date

Hi everyone

I am trying to make my custom calendar (as Outlook Calendar), I want:

1. Every app start, Gallery 1 (events) displaying by current date (today)

2. When click on date in weekday gallery 2, events in Gallery 1 will displaying by selected date. Pls help me ( sorry for my Eng)

1 ACCEPTED SOLUTION

Accepted Solutions
v-qiaqi-msft
Community Support
Community Support

Hi @BuiDucNghia,

Do you want to display the events based on current date once the app is on start?

Could you please share a bit more about your scenario?

 

1). Set the OnStart property as below:

ClearCollect(Events,SortByColumns(Filter(MyCalendarEvents,Text(Start,DateTimeFormat.ShortDate)=Text(Today(),DateTimeFormat.ShortDate)),"Start")

2). Add a DatePicker and set the OnSelect as below:

 

Set(SelectedDate,DatePicker1.SelectedDate)

 

3). Populate the Gallery with the collection as below:

If(
    !IsBlank(SelectedDate),
    SortByColumns(
        Filter(
            Events,
            Text(
                Start,
                DateTimeFormat.ShortDate
            ) = Text(
                SelectedDate,
                DateTimeFormat.ShortDate
            )
        ),
        "Start"
    ),
    SortByColumns(
        Filter(
            Events,
            Text(
                Start,
                DateTimeFormat.ShortDate
            ) = Text(
                _dateSelected,
                DateTimeFormat.ShortDate
            )
        ),
        "Start"
    )
)

 

Best Regards,
Qi

View solution in original post

1 REPLY 1
v-qiaqi-msft
Community Support
Community Support

Hi @BuiDucNghia,

Do you want to display the events based on current date once the app is on start?

Could you please share a bit more about your scenario?

 

1). Set the OnStart property as below:

ClearCollect(Events,SortByColumns(Filter(MyCalendarEvents,Text(Start,DateTimeFormat.ShortDate)=Text(Today(),DateTimeFormat.ShortDate)),"Start")

2). Add a DatePicker and set the OnSelect as below:

 

Set(SelectedDate,DatePicker1.SelectedDate)

 

3). Populate the Gallery with the collection as below:

If(
    !IsBlank(SelectedDate),
    SortByColumns(
        Filter(
            Events,
            Text(
                Start,
                DateTimeFormat.ShortDate
            ) = Text(
                SelectedDate,
                DateTimeFormat.ShortDate
            )
        ),
        "Start"
    ),
    SortByColumns(
        Filter(
            Events,
            Text(
                Start,
                DateTimeFormat.ShortDate
            ) = Text(
                _dateSelected,
                DateTimeFormat.ShortDate
            )
        ),
        "Start"
    )
)

 

Best Regards,
Qi

Helpful resources

Announcements
Super User 2 - 2022 Congratulations 768x460.png

Welcome Super Users

The Super User program for 2022 - Season 2 has kicked off!

Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

<
Users online (3,668)