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

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
Community Support Team
Community Support Team

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
Community Support Team
Community Support Team

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
Better Together’ Contest Finalists Announced!

'Better Together’ Contest Finalists Announced!

Congrats to the finalists of our ‘Better Together’-themed T-shirt design contest! Click for the top entries.

thirdimage

Power Apps Community User Group Member Badge

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

sixthImage

Join THE global Microsoft Power Platform event series

Attend for two days of expert-led learning and innovation on topics like AI and Analytics, powered by Dynamic Communities

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

thirdimage

Microsoft Business Applications Virtual Launch

Join us for the Microsoft Business Applications Virtual Launch Event on Thursday, April 2, 2020, at 8:00 AM PST.

thirdimage

Community Summit North America

Innovate, Collaborate, Grow - The top training and networking event across the globe for Microsoft Business Applications

Top Solution Authors
Top Kudoed Authors
Users online (5,382)