cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Regular Visitor

How to filter gallery based on another galleys collection

First Gallery displays the working hours from 9 to 5. 

 

Second Gallery displays the usernames. When a user selects the second gallery, it will retrieve the selected users' available hours. 

 

When the user clicks on the second gallery, how do I update the filter on the first gallery to show only the available time for that particular user? Is it also possible to display the unavailable hours in a different color and the available in another color in the first gallery ?   

 

Gallery 1

 

ClearCollect(
        CollectionListHours,
        {
            Name: "09:00 am",
            SMinutes: TimeValue("09:00:00"),
            EMinutes: TimeValue("10:00:00")
        },
        {
            Name: "09:30 am",
            SMinutes: TimeValue("09:30:00"),
            EMinutes: TimeValue("10:30:00")
        },
        {
            Name: "10:00 am",
            SMinutes: TimeValue("10:00:00"),
            EMinutes: TimeValue("11:00:00")
        },
        {
            Name: "10:30 am",
            SMinutes: TimeValue("10:30:00"),
            EMinutes: TimeValue("11:30:00")
        },
        {
            Name: "11:00 am",
            SMinutes: TimeValue("11:00:00"),
            EMinutes: TimeValue("12:00:00")
        },
        {
            Name: "11:30 am",
            SMinutes: TimeValue("11:30:00"),
            EMinutes: TimeValue("12:30:00")
        },
        {
            Name: "12:00 pm",
            SMinutes: TimeValue("12:00:00"),
            EMinutes: TimeValue("13:00:00")
        },
        {
            Name: "12:30 pm",
            SMinutes: TimeValue("12:30:00"),
            EMinutes: TimeValue("13:30:00")
        },
        {
            Name: "01:00 pm",
            SMinutes: TimeValue("13:00:00"),
            EMinutes: TimeValue("14:00:00")
        },
        {
            Name: "01:30 pm",
            SMinutes: TimeValue("13:30:00"),
            EMinutes: TimeValue("14:30:00")
        },
        {
            Name: "02:00 pm",
            SMinutes: TimeValue("14:00:00"),
            EMinutes: TimeValue("15:00:00")
        },
        {
            Name: "02:30 pm",
            SMinutes: TimeValue("14:30:00"),
            EMinutes: TimeValue("15:30:00")
        },
        {
            Name: "03:00 pm",
            SMinutes: TimeValue("15:00:00"),
            EMinutes: TimeValue("16:00:00")
        },
        {
            Name: "03:30 pm",
            SMinutes: TimeValue("15:30:00"),
            EMinutes: TimeValue("16:30:00")
        },
        {
            Name: "04:00 pm",
            SMinutes: TimeValue("16:00:00"),
            EMinutes: TimeValue("17:00:00")
        },
        {
            Name: "04:30 pm",
            SMinutes: TimeValue("16:30:00"),
            EMinutes: TimeValue("17:30:00")
        },
        {
            Name: "05:00 pm",
            SMinutes: TimeValue("17:00:00"),
            EMinutes: TimeValue("18:00:00")
        }
    );

 

 

Gallery 2

 

ClearCollect(
    CollectionFakeWorkingHours,
    {
        Name: "09:00 am",
        SMinutes: TimeValue("09:00:00"),
        EMinutes: TimeValue("10:00:00")
    },
    {
        Name: "09:30 am",
        SMinutes: TimeValue("09:30:00"),
        EMinutes: TimeValue("10:30:00")
    },
    {
        Name: "11:00 am",
        SMinutes: TimeValue("11:00:00"),
        EMinutes: TimeValue("12:00:00")
    },
    {
        Name: "11:30 am",
        SMinutes: TimeValue("11:30:00"),
        EMinutes: TimeValue("12:30:00")
    },
    {
        Name: "12:00 pm",
        SMinutes: TimeValue("12:00:00"),
        EMinutes: TimeValue("13:00:00")
    },

    {
        Name: "02:00 pm",
        SMinutes: TimeValue("14:00:00"),
        EMinutes: TimeValue("15:00:00")
    }

);

 

 

Thanks !

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Community Support
Community Support

Re: How to filter gallery based on another galleys collection

Hi @DevMolly100 ,

Could you please share a bit more about your scenario?

Could you please share more details about the formula you typed within the second Gallery?

Does the first Gallery (Gallery1) connect to the CollectionListHours collection? Could you please share a bit more about the CollectionFakeWorkingHours collection?

Futher, do you want to filter your first Gallery based on the selected user within your second Gallery?

 

I assume that the selected user within the second Gallery would own individual SMinutes and EMinutes value, is it true? Does the CollectionFakeWorkingHours represents the avaiable hours for the selected user within the second Gallery?

 

If the CollectionFakeWorkingHours represents the avaiable hours for the selected user within the second Gallery, I have made a test on my side, please consider take a try with the following workaround:

Set the Items property of the first Gallery to following:

Filter(
       CollectionListHours,
       If(
          IsEmpty(CollectionFakeWorkingHours),
          true,
          Name in CollectionFakeWorkingHours.Name
       )
)

 

If you want to color the available hours and unavailable hours in a different color, please consider take a try with the following workaround:

Within your first Gallery, set the TemplateFill property to following:

If(
    ThisItem.Name in CollectionFakeWorkingHours.Name,
    RGBA( 0, 128, 0, 1 ),
    RGBA( 255, 0, 0, 1 )
)

5.JPG

Please consider take a try with above solution, then check if the issue is solved.

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

1 REPLY 1
Highlighted
Community Support
Community Support

Re: How to filter gallery based on another galleys collection

Hi @DevMolly100 ,

Could you please share a bit more about your scenario?

Could you please share more details about the formula you typed within the second Gallery?

Does the first Gallery (Gallery1) connect to the CollectionListHours collection? Could you please share a bit more about the CollectionFakeWorkingHours collection?

Futher, do you want to filter your first Gallery based on the selected user within your second Gallery?

 

I assume that the selected user within the second Gallery would own individual SMinutes and EMinutes value, is it true? Does the CollectionFakeWorkingHours represents the avaiable hours for the selected user within the second Gallery?

 

If the CollectionFakeWorkingHours represents the avaiable hours for the selected user within the second Gallery, I have made a test on my side, please consider take a try with the following workaround:

Set the Items property of the first Gallery to following:

Filter(
       CollectionListHours,
       If(
          IsEmpty(CollectionFakeWorkingHours),
          true,
          Name in CollectionFakeWorkingHours.Name
       )
)

 

If you want to color the available hours and unavailable hours in a different color, please consider take a try with the following workaround:

Within your first Gallery, set the TemplateFill property to following:

If(
    ThisItem.Name in CollectionFakeWorkingHours.Name,
    RGBA( 0, 128, 0, 1 ),
    RGBA( 255, 0, 0, 1 )
)

5.JPG

Please consider take a try with above solution, then check if the issue is solved.

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

Watch Now

Experience what’s next for Power Apps

See the latest Power Apps innovations, updates, and demos from the Microsoft Business Applications Launch Event.

Power Platform ISV Studio

Power Platform ISV Studio

ISV Studio is designed to become the go-to Power Platform destination for ISV’s to monitor & manage published applications.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (6,600)