cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
forbudt4u
Resolver I
Resolver I

Filtering within Pop-Up Guidance

Hello,

 

I am seeking advice on a filtering issue I am having as the developer we originally hired built our Apps Admin Portal as a Pop-Up Screen (with its own gallery) rather than its own screen... which I can't make sense of.  However, we are where we are and I'm trying to find a filtering solution within the Pop-Up that mirrors the filter that's on the main screen gallery.  I will show below where I'm currently at and where I'm trying to get. 

 

CURRENT SITUATION (FOR CONTEXT)

I have a Screen named AssetManagementScreen that has a Gallery that loads as it should, and has a Filter pop-up that works as it should when you interact with it... Below is the Screen's OnVisible Property:

 

 

 

ClearCollect(
    _OwnAssets,
    Filter(
        'All Asset List',
        Holder = _User.Title
    )
);
ClearCollect(
    _OwnAssetsManufacturer,
    SortByColumns(
        Distinct(
            _OwnAssets,
            ManufacturerBK
        ),
        "Result",
        Ascending
    )
);
ClearCollect(
    _OwnAssetsModel,
    SortByColumns(
        Distinct(
            _OwnAssets,
            ModelBK
        ),"Result",
        Ascending
    )
);
ClearCollect(
    _OwnAssetsSerialNumber,
    SortByColumns(
        Distinct(
            _OwnAssets,
            'Serial#'
        ),"Result",
        Ascending
    )
);
ClearCollect(
    _OwnAssetsScanTag,
    SortByColumns(
        Distinct(
            _OwnAssets,
            'ScanTag#'
        ),"Result",
        Ascending
    )
);
ClearCollect(
    _OwnAssetsCategory,
    SortByColumns(
        Distinct(
            _OwnAssets,
            CategoryBK
        ),"Result",
        Ascending
    )
);
ClearCollect(
    _OwnAssetsStatus,
    SortByColumns(
        Distinct(
            _OwnAssets,
            Status.Value
        ),"Result",
        Ascending
    )
);
ClearCollect(
    _Model,
    Model
);
UpdateContext(
    {
        _ConfirmationPopUp: false,
        _SearchPopUp: If(_User.Admin And Not(SearchTextBox.Text=Blank()),_SearchPopUp,false),
        _FilterPopUp: false,
        _SelectAll: false,
        _ResetCheckboxes: true,
        _SearchGalleryNotes:false
    }
);
Reset(TransferToSelect)

 

 

 

Upon launching this Screen, the user will get the below result within a Gallery named AssetManGallery (Items properties below pic)

AssetManagementScreen.PNG

 

 

 

FirstN(If(
    IsBlank(_SearchBarcodeScan),
    Sort(
        Sort(
            _OwnAssets,
            CategoryBK,
            Ascending
        ),
        'Transfer Status',
        Descending
    ),
    Sort(
        Filter(
            _OwnAssets,
            'ScanTag#' = _SearchBarcodeScan
        ),
        "Category"
    )
),1000)

 

 

 

In the upper left-hand corner of the screen you'll see a filter button that produces a pop-up with Filter Dropdowns and 2 Buttons, Apply Filter & Clear Filter (pop-up pic and button OnSelect Properties below).

 

AMFilterPop-Up.PNG

Apply Filter Button OnSelect Properties

 

 

 

If(
    FilterByDrpDwn.Selected.Value = "Manufacturer",
    ClearCollect(
        _OwnAssets,
        Filter(
            _OwnAssets,
            ManufacturerBK = OptionDrpDwn.SelectedText.Value
        )
    ),
    If(
        FilterByDrpDwn.Selected.Value = "Category",
        ClearCollect(
            _OwnAssets,
            Filter(
                _OwnAssets,
                CategoryBK = OptionDrpDwn.SelectedText.Value
            )
        ),
        If(
            FilterByDrpDwn.Selected.Value = "Status",
            ClearCollect(
                _OwnAssets,
                Filter(
                    _OwnAssets,
                    Status.Value = OptionDrpDwn.SelectedText.Value
                )
            ),
            If(
                FilterByDrpDwn.Selected.Value = "ScanTag#",
                ClearCollect(
                    _OwnAssets,
                    Filter(
                        _OwnAssets,
                    'ScanTag#' = OptionDrpDwn.SelectedText.Value
                    )
                ),
                If(
                    FilterByDrpDwn.Selected.Value = "Serial#",
                    ClearCollect(
                        _OwnAssets,
                        Filter(
                            _OwnAssets,
                            'Serial#' = OptionDrpDwn.SelectedText.Value
                        )
                    ),
                    If(
                        FilterByDrpDwn.Selected.Value = "Model",
                        ClearCollect(
                            _OwnAssets,
                            Filter(
                                _OwnAssets,
                                ModelBK = OptionDrpDwn.SelectedText.Value
                            )
                        )
                    )
                )
            )
        )
    )
);
UpdateContext({_FilterPopUp: false});

 

 

 

Clear Filter Button OnSelect Properties

 

 

 

ClearCollect(
    _OwnAssets,
    Filter(
        'All Asset List',
        Holder = _User.Title
    )
);UpdateContext({_FilterPopUp:false})

 

 

 

After clicking the Apply Filter Button, the Gallery Updates as it should and does the same when you click the Clear Filter Button.  Where I need advice is the Admin Portal our developer built as they built it as a Pop-Up window rather than its own Screen.  It's debatable if that was the correct method or not, but I obviously want to keep it the way it is rather than rebuilding an entire new screen when the pop-up does exactly what I need it to do... BUT, Filter! 

 

You get to the pop-up (SearchPopUp) by clicking on the SpyGlass Icon on the upper right-hand corner of the Asset Management Screen.  The Icon is only visible to users deemed Admins in our SharePoint Contact List.  The Gallery (SearchGallery) contained in this pop-up is very similar to the AssetManGallery on the main Asset Management Screen as far as it looks, it just allows an admin to do a more in-depth search of the entire SharePoint All Asset List as well as advanced asset transferring abilities.  Below is a pic of the SearchPopUp and the Item Properties below it.  

SearchPopUp.PNG

 

 

If(PendingCheckbox.Value=false,
FirstN(SortByColumns(Filter('All Asset List', !(IsBlank(SearchTextBox.Text) && IsBlank(SearchPopupBarcodeScanLbl.Text)) && (IsBlank(SearchPopupBarcodeScanLbl.Text) || 'ScanTag#'=SearchPopupBarcodeScanLbl.Text) && (IsBlank(SearchTextBox.Text) || StartsWith('ScanTag#', SearchTextBox.Text) || StartsWith(Holder, SearchTextBox.Text) || StartsWith(CategoryBK, SearchTextBox.Text) ||  StartsWith(ManufacturerBK, SearchTextBox.Text) || StartsWith('Serial#', SearchTextBox.Text  ) ) ),"CategoryBK",Ascending),2000),
FirstN(Sort(Filter('All Asset List', !(IsBlank(SearchTextBox.Text) && IsBlank(SearchPopupBarcodeScanLbl.Text)) && (IsBlank(SearchPopupBarcodeScanLbl.Text) || 'ScanTag#'=SearchPopupBarcodeScanLbl.Text) && (IsBlank(SearchTextBox.Text) || StartsWith('ScanTag#', SearchTextBox.Text) || StartsWith(Holder, SearchTextBox.Text) || StartsWith(CategoryBK, SearchTextBox.Text) ||  StartsWith(ManufacturerBK, SearchTextBox.Text) || StartsWith('Serial#', SearchTextBox.Text  ) ) ),'Transfer Status',Descending),2000))

 

 

Again, this Admin pop-up does exactly what I want it to do.  However, I am trying to mirror the filter functionality within this pop-up as I have on the main Asset Management Screen.  The only difference is that the main screen gallery & filter are working from a Collection, and the SearchPopUp is working by directly filtering the All Asset List and displaying the results in the SearchGallery.  So, as you can see, I am essentially wanting to post-filter the filter that already exists within the SearchGallery based on the text that's entered in the Input Text Field OR the Barcode scanned that's at the top of the pop-up when pressing the Scan Button. 

 

WHERE I'M TRYING TO GET

 

I have successfully created the SearchPopUpFilter pop-up (accessed via filter icon above the SearchGallery) that populates the respective drop-downs based on the SearchGallery results.   The only difference is that I am only offering Category, Manufacturer, Model & Status as the choices in the Filter By Dropdown.  Now, I'm just trying to get the SearchGallery to update the gallery based on the selected filter options when I click the Apply Filter Button, and when I click the Clear Filter button return the SearchGallery back to the original filtered results (based on text entry or barcode scanned in).  

SearchPopUpFilter.PNG

If it matters, the following are the names of the controls in the SearchPopUpFilter pop-up...  Filter By Dropdown (FilterByDrpDwn_1) and Option Dropdown (OptionDrpDwn_1).  

 

I'm hoping we can work within the current environment and not have to reinvent the wheel with a new screen, but I am all ears on any guidance as I've been trying to figure this one out for a few days with no luck. I can also provide any other info that's needed.  

 

Thank you!  

2 REPLIES 2
forbudt4u
Resolver I
Resolver I

Alright, I think I figured this out... but it does create more loading time for searches with larger result sets, but I placed an animated GIF over the SearchGallery while it's loading. The good news is that a I can do many more sorts on my SearchGallery now that it's filtering much smaller datasets and not my 10,000 plus record All Asset List on SharePoint. 

 

1. I copied the SearchGallery, named it SearchGallery_1 and set the visible properties to false so it's hidden and gave it the following Items properties:

 

FirstN(SortByColumns(Filter('All Asset List', !(IsBlank(SearchTextBox.Text) && IsBlank(SearchPopupBarcodeScanLbl.Text)) && (IsBlank(SearchPopupBarcodeScanLbl.Text) || 'ScanTag#'=SearchPopupBarcodeScanLbl.Text) && (IsBlank(SearchTextBox.Text) || StartsWith('ScanTag#', SearchTextBox.Text) || StartsWith(Holder, SearchTextBox.Text) || StartsWith(CategoryBK, SearchTextBox.Text) ||  StartsWith(ManufacturerBK, SearchTextBox.Text) || StartsWith('Serial#', SearchTextBox.Text  ) ) ),"CategoryBK",Ascending),2000)

 

2. I then set my SearchTextBox text input so it will create a collection upon updating the text input field, and gave it an OnChange property of:

 

If(IsBlank(SearchTextBox),Clear(_SearchGalleryResults),ClearCollect(_SearchGalleryResults,SearchGallery_1.AllItems))

 

 3. After than I changed the Items property of SearchGallery to:

 

If(PendingCheckbox.Value=true, Sort(Sort(_SearchGalleryResults,CategoryBK,Ascending),'Transfer Status',Descending),Sort(Sort(_SearchGalleryResults,ManufacturerBK,Ascending),CategoryBK,Ascending))

 

 4. Finally, my Apply Filters Button OnSelect properties to:

 

If(
    FilterByDrpDwn_1.Selected.Value = "Manufacturer",
    ClearCollect(
        _SearchGalleryResults,
        Filter(
            _SearchGalleryResults,
            ManufacturerBK = OptionDrpDwn_1.SelectedText.Value
        )
    ),
    If(
        FilterByDrpDwn_1.Selected.Value = "Category",
        ClearCollect(
            _SearchGalleryResults,
            Filter(
                _SearchGalleryResults,
                CategoryBK = OptionDrpDwn_1.SelectedText.Value
            )
        ),
        If(
            FilterByDrpDwn_1.Selected.Value = "Status",
            ClearCollect(
                _SearchGalleryResults,
                Filter(
                    _SearchGalleryResults,
                    Status.Value = OptionDrpDwn_1.SelectedText.Value
                )
            ),
                    If(
                        FilterByDrpDwn_1.Selected.Value = "Model",
                        ClearCollect(_SearchGalleryResults,
                            Filter(
                                _SearchGalleryResults,
                                ModelBK = OptionDrpDwn_1.SelectedText.Value
                            )
                        )
                    )
                )
            )
        )
;
UpdateContext({_SearchFilterPopUp: false});



 

 

Although I'm happy I persisted and figured this out on my own, really could use some advice if my workaround will potentially create other issues.   If anyone has any suggestions or notices any unneeded properties, please let me know.   


Thanks

Already found a huge consequential issue and I cannot use this solution.  The search functionality is just the initial interaction with the original gallery I want to be able to filter. But, the second part is being able patch records within the gallery based on the chosen updates.  Seeing that I would be working from a collection within the gallery rather than the actual record from the source, I lost my patch functionality.  So, I'm back to the drawing board.  There's got to be a way to filter within this dang gallery without creating a collection.... ugggghhhhh

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 (1,672)