cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
araelius86
Helper I
Helper I

Filter based on previous selected Variable.

Hi,

 

I am trying to build an app off one list of variables. 

On the first screen I have a list of departments populated from the Sharepoint list.

The items formula for Gallery1 looks like this 

 

Distinct('Customer Services Branch Phone List', Department)

 

I have buttons next to each populated department with formula

Set(Variable, ThisItem);Navigate(NameList, Fade)

My problem begins with populating a second gallary off the selection from the first.

I need help with the formula to populate gallery2 with only the Names of the people that are associated with the Department chosen in Gallery1

Many thanks


1 ACCEPTED SOLUTION

Accepted Solutions
RusselThomas
Microsoft
Microsoft

Hi araelius86,

 

Can you confirm what the content of the vairable is once you've pushed the button? (Use the Variables option under View menu).

 

Distinct returns a table with a single column by default titled "Result".    

If you Set(variable, ThisItem) then the variable is likely to be a row of data (again, even if it's only one column it's still constructed as a row).

 

Constructed as above, to access the value I suspect you might need to use variable.Result

 

To filter another gallery with the same data by the variable you would set the Items to

Filter('Customer Services Branch Phone List', Department=variable.Result)

 

Alternatively, you could change your Set() function to

Set(variable, Thisitem.Result)

in which case you can access the value just by using variable.

 

Filter('Customer Services Branch Phone List', Department=variable)

That said, you can simply use the Gallery.Selected option and avoid the variable entirely (although if you plan to use it elsewhere in your app you may still want it).  This assumes your buttons for each row are actually inside the gallery card and not outside.

 

For this, just set the button to 

 

Navigate(NameList, Fade)

And in the Items property of the second gallery

Filter('Customer Services Branch Phone List', Department=Gallery1.Selected.Result)

 

Hope this helps 🙂

 

Kind regards

RT

View solution in original post

4 REPLIES 4
RusselThomas
Microsoft
Microsoft

Hi araelius86,

 

Can you confirm what the content of the vairable is once you've pushed the button? (Use the Variables option under View menu).

 

Distinct returns a table with a single column by default titled "Result".    

If you Set(variable, ThisItem) then the variable is likely to be a row of data (again, even if it's only one column it's still constructed as a row).

 

Constructed as above, to access the value I suspect you might need to use variable.Result

 

To filter another gallery with the same data by the variable you would set the Items to

Filter('Customer Services Branch Phone List', Department=variable.Result)

 

Alternatively, you could change your Set() function to

Set(variable, Thisitem.Result)

in which case you can access the value just by using variable.

 

Filter('Customer Services Branch Phone List', Department=variable)

That said, you can simply use the Gallery.Selected option and avoid the variable entirely (although if you plan to use it elsewhere in your app you may still want it).  This assumes your buttons for each row are actually inside the gallery card and not outside.

 

For this, just set the button to 

 

Navigate(NameList, Fade)

And in the Items property of the second gallery

Filter('Customer Services Branch Phone List', Department=Gallery1.Selected.Result)

 

Hope this helps 🙂

 

Kind regards

RT

View solution in original post

Thanks Russel,

 

That second lot of formulas worked.

I have a third screen in which I want to display the details of the Person selected from the NameList.

 

Would it be a similar formula for the item input?

In addition,

 

I want to be able to search in either namelist or Gallery1 for a name and have it display the 3rd page named "Detail Screen1_2"

I have distinct as a function on the gallery because my list has the department for each person and if I auto populate the Gallery1 it duplicates the Department for every name in the list.

 

Is there a better way to display the Departments only once?

Never mind this. I solved with Gallery2.selected.

 

Helpful resources

Announcements
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

MBAS Attendee Badge

Claim Your Badge & Digital Swag!

Check out how to claim yours today!

secondImage

Are Your Ready?

Test your skills now with the Cloud Skill Challenge.

secondImage

Demo Extravaganza is Back!

We are excited to announce that Demo Extravaganza for 2021 has started!

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

Top Solution Authors
Top Kudoed Authors
Users online (66,316)