cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Anonymous
Not applicable

Different BrowseGallery according to filter

Hi everyone,

 

I am fairly new to this forum and PowerApps, so I apologise if this has already been explained in other topics.

 

My problem:

 

I am currently in the process of creating an application based on an Excel MainTable, which has a variety of different columns. Here a new item can be added and be edited as a "Lead", "Opportunity", "Proposal Dev", "Proposal Sent", etc. etc.

 

The list will eventually get long and hence I thought I would create an overall Mainpage which would direct to different BrowseGalleries according to whether they are "Lead", "Opportunity", etc. etc.

 

 

Filter for the searchbox and browsegalleryFilter for the searchbox and browsegallery

 

However, after doing this, I realise that the form can only show items from one gallery:

 

BrowserGalleryProblem2.JPG

 

Is it possible to open the FormMode.Edit FormMode.View regardless of which BrowseGallery it comes from?

 

Kind regards

8 REPLIES 8
EricLott
Resident Rockstar
Resident Rockstar

In each Gallery's OnSelect property for a gallery item, you can add this formula to set a variable (in this case called "GalleryType".) to whatever type you're working with.

Example:

Set(GalleryType,"Lead")

Then, in the Items property of your Edit Form, you can add a switch, like this:

Switch(GalleryType,
"Lead", Gallery1.Selected,
"Opportunity", Gallery2.Selected,
"Proposal Dev", Gallery3.Selected)

 

Anonymous
Not applicable

Hi Eric,

 

Thank you very much for the quick response.

 

Apologies, as I am new with PowerApps, I do not exactly follow what you mean. When you set a variable to a name such as "GalleryType", where do I need to add this? The below picture is with following formula: Set(GalleryType; "Lead") ---(Changed as I was trying different things when it did not work).

 

BrowserGalleryProblem3.JPG

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

See below example. The formula for the OnSelect needs to be for the Gallery Item, not the entire gallery.

If Phase is the name of your property you could do this:

Set(GalleryPhaseType,ThisItem.Phase).

powerAppsExample.png

Anonymous
Not applicable

So I have tried to do that, but it does not seem to redirect me anywhere when I go into "Test-Mode", am I missing something?

Although the below formula is slight different I believe these are identical, right? In the PowerApps I use I have to use ";"

 

BrowserGalleryProblem4.JPG

You'll need to add a Navigate() function after the Select(Parent) with the appropriate screen you want to navigate to.

Anonymous
Not applicable

Hi again, thank you for the help.

 

I have tried all the things you have asked without luck until now. I guess being new and having to work with a different syntax seems to be an obstacle.

 

I have tried to tidy up the different layers and have now added one Page including Browse Gallery for each of the different phases ("Leads", "Opportunity", "Proposal Dev", etc.) and added the code you suggested:

 

BrowserGalleryProblem6.JPG

 

 

 

 

 

 

 

 

 

I tried with and without & Navigate(EditTest), but nothing shows up.

 

Below is the filter for each of the galleries (I have also here tried without the ";Phase = "Leads")

 

BrowserGalleryProblem7.JPG

 

 

 

 

 

 

 

 

 

 

Lastly I added the initial code you suggested using the Switch(, but here I seem to get a syntax error:

 

BrowserGalleryProblem5.JPG

 

 

 

 

 

 

 

 

 

 

 

This is definitely doable without having a gallery for each type. That will complicate things down the road. It's best to get it working so that the gallery fills dynamically.

 

The syntax is confusing to me in the screenshots. It's not like the syntax I'm using. I was unaware there was different syntax in different languages.

 

To explain without explicit examples (hopefully someone else can help with the syntax), The Items property will be a filtered result of your MainTable data where the filter for Phase will be a dynamic variable (either from a Textbox or other selection method). That will drive the Gallery data without needed one for each Phase.

 

From there, when selecting a gallery item from the main gallery, that selected item will drive the further filtering needed to edit or create an entry. The functions needed to make all this happen are the usual suspects (Filter(), Set(), Lookup(), Switch())

 

Hopefully that helps, but there seems to be some problems showing explicit examples.

Anonymous
Not applicable

Thank you. I have now figured out how to change the language so that I keep the same syntax.

 

I think you are certainly right, it must be able to be done in a more neat way, rather than having several different galleries.

 

I will keep your advice in mind and try.

Helpful resources

Announcements
PA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

Power Query PA Forum 768x460.png

Check it out!

Did you know that you can visit the Power Query Forum in Power BI and now Power Apps

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.

PowerPlatform 768x460.png

Microsoft Learn

Check out our new Discover Your Career Path blog post series and get all the details.

Users online (1,200)