cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
CarlHRVA
Continued Contributor
Continued Contributor

Help filtering a gallery from a different screen

Hello,


I have a PowerApp for a document library that I am creating and in it I have a landing screen where I would like to allow users to filter the gallery on a second screen before navigating to the second screen on-click. I read that I should accomplish this with a temporary collection and setting the data source of the gallery to the temp collection but I've not been able to get the formula to work. For now I am only trying to establish one filter for a field I'll call "Zone". "Zone" is a look up column, looking up to a "Master Process List". I use a drop down for this look up field "Zone" and would like to filter the gallery of the library with this selected value and navigate to the screen screen on-click. The formula I am currently using is:

 

ClearCollect(

       temp,

       Filter(

               'Process Document Library',

                Zone = Dropdown1_1.SelectedText.Value

)

);

Navigate(

              'Approver/OwnerScreen',

               None)

 

This is returning an invalid argument type. I'm sure that I am supposed to use the ID for this in some capacity but I don't fully understand this aspect of look up columns yet. Thanks for any help! @wyotim 

1 ACCEPTED SOLUTION

Accepted Solutions
wyotim
Resident Rockstar
Resident Rockstar

Hey @CarlHRVA, try this and let me know if it does the trick:

ClearCollect(
    temp,
    Filter(
        'Process Document Library',
        Tower.Value = Dropdown1_1.Selected.Zone 
    )
);
Navigate(
    'Approver/OwnerScreen',
    None
)

Here I am assuming that Zone is the item being looked up in the dropdown (which is in turn connected to the 'Master Process List') and Tower is the field in 'Process Document Library' that is being referenced. Again, let me know if this does or doesn't work!

View solution in original post

11 REPLIES 11
wyotim
Resident Rockstar
Resident Rockstar

Hey @CarlHRVA, try this and let me know if it does the trick:

ClearCollect(
    temp,
    Filter(
        'Process Document Library',
        Tower.Value = Dropdown1_1.Selected.Zone 
    )
);
Navigate(
    'Approver/OwnerScreen',
    None
)

Here I am assuming that Zone is the item being looked up in the dropdown (which is in turn connected to the 'Master Process List') and Tower is the field in 'Process Document Library' that is being referenced. Again, let me know if this does or doesn't work!

View solution in original post

CarlHRVA
Continued Contributor
Continued Contributor

Yes! Thank you @wyotim . I have just about figured it out and got there with your help. The only thing different in my formula that worked was:

 

ClearCollect(
    temp,
    Filter(
        'Process Document Library',
        Tower.Value = Dropdown1_1.Selected.Result //changed from .Zone to .Result//
    )
);
Navigate(
    'Approver/OwnerScreen',
    None
)

 

Now what I will attempt to do, before I ask you for more help (thank you so much, really), is set it up so that they can filter on only one OR multiple different fields at a time. Thank you again!

 

wyotim
Resident Rockstar
Resident Rockstar

I’m sure you’ll nail it! But should any issues arise, I’m happy to assist!
CarlHRVA
Continued Contributor
Continued Contributor

@wyotim Wondering if you might help me with my filter function.

 

What I currently have is:

 

Distinct(
    If(
        IsBlank(Dropdown1_1.Selected.Result),
         'Document Library'.Operating_Text,
        IsBlank(Dropdown3_1.Selected.Result),
        'Document Library'.Operating_Text,
        Filter(
            'Document Library',
            'Organizational Model'.Value = Dropdown3_1.Selected.Result
        ).Operating_Text
    ),
    Operating_Text
)

 

What I'd like to do is include a Region filter for each statement. So... 

 

If Dropdown1_1 is blank then Document Library.Operating_Text when Region = Dropdown5.Selected.Result

 

Does that make sense? 

 

Thank you!

wyotim
Resident Rockstar
Resident Rockstar

Hey @CarlHRVA, apologies for the radio silence on my end. I caught a bad illness (not the big one in the news) and am just getting back to the land of the living. I saw you had another topic that you solved yourself (great job!); do you still need some assistance with this filter? I'd be happy to help out if you do!

CarlHRVA
Continued Contributor
Continued Contributor

@wyotim Welcome back. No apologies necessary, you've been ridiculously helpful and I'm sorry to hear you were feeling under the weather! I could definitely still use help with this filter. Did I properly explain what I was trying to do before? Thank you!

wyotim
Resident Rockstar
Resident Rockstar

@CarlHRVA I think I understand what you are needing. But let me try and put it into words to make sure.

 

  • If Dropdown1_1 is blank, filter 'Document Library' by Region using Dropdown5.Selected.Result
    • (Assumed by me) If Dropdown5 is blank, don't filter 'Document Library'
  • If Dropdown1_1 is not blank, filter 'Document Library' by 'Organizational Model'.Value using Dropdown3_1.Selected.Result
    • If Dropdown3_1 is blank, don't filter 'Document Library'

In essence, if Dropdown1_1 is blank, use Dropdown5 to filter; otherwise use Dropdown3_1. 

 

Does that sum it up? If so, try this and see if it does the trick:

Distinct(
    If(
        IsBlank(Dropdown1_1.Selected.Result),
        Filter(
            'Document Library',
            Region = Dropdown5.Selected.Result || IsBlank(Dropdown5.Selected.Result)
        ),
        Filter(
            'Document Library',
            'Organizational Model'.Value = Dropdown3_1.Selected.Result || IsBlank(Dropdown3_1.Selected.Result)
        )
    ),
    Operating_Text
)

 

CarlHRVA
Continued Contributor
Continued Contributor

Hey @wyotim thanks for the thoughtful response, as always. That's not exactly what I am trying to achieve unfortunately. First thing to note, Dropdown5 will always have a value. First they select a value for Dropdown 5(Region) and then they can add additional filters onto that, should they choose to do so.  If Dropdown5 and Dropdown1_1 is not null, filter on both else, if Dropdown5 and Dropdown3_1 is not null, filter on both, else if Dropdown5, Dropdown1_1 and Dropdown3_1 is not null, filter on all 3, else filter on just Dropdown5. Does that make sense? Thanks!

 

 

wyotim
Resident Rockstar
Resident Rockstar

@CarlHRVA Thank you for clarifying! I certainly was misunderstanding you there. Try this instead:

Distinct(
    Filter(
        'Document Library',
        Region = Dropdown5.Selected.Result,
        'What Dropdown1_1 Filters' = Dropdown1_1.Selected.Result || IsBlank(Dropdown!_1.Selected.Result),
        'Organizational Model'.Value = Dropdown3_1.Selected.Result || IsBlank(Dropdown3_1.Selected.Result)
        )
    ),
    Operating_Text
)

The 'What Dropdown1_1 Filters' is there because I wasn't sure what it was. Earlier in the thread, you had a Tower.Value associated with Dropdown1_1, so that might be it. 

 

To explain this a bit, in the Filter function, multiple filter conditions (separated by commas after the data source) act like they are joined by an And (&& when used symbolically). I added some Or statements (the || symbol) in there means as well. You might know this already but for those who come upon this thread in the future, for And statements, all conditions must be true or the result is false. For Or statements, only one condition must be true; only if all conditions are false will it return false. So in this filter, we have three statements that must be true:

 

  1. A value must be selected for Dropdown5 that can be found in the Region field
  2. Either a selected value for Dropdown1_1 can be found in the (assumed) Tower field or Dropdown1_1 has nothing selected
  3. Either a selected value for Dropdown3_1 can be found in the Operational Model field or Dropdown3_1 has nothing selected

Essentially, we have created a condition that accounts for values or no values being selected in Dropdown1_1 and Dropdown3_1. 

 

Let me know if that does what you need! If not, we'll keep at it!

Helpful resources

Announcements
PA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

secondImage

Power Apps Community Call

Please join us on Wednesday, October 20th, at 8a PDT. Come and learn from our amazing speakers!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Welcome Super Users.jpg

Super User Season 2

Congratulations, the new Super User Season 2 for 2021 has started!

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Top Solution Authors
Top Kudoed Authors
Users online (1,358)