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
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.

Power Platform Call June 2022 768x460.png

Power Platform Community Call

Join us for the next call on June 15, 2022 at 8am PDT.

PA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.

PA.JPG

New Release Planning Portal (Preview)

Check out our new release planning portal, an interactive way to plan and prepare for upcoming features in Power Platform.

Top Solution Authors
Top Kudoed Authors
Users online (2,302)