cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Responsive Resident
Responsive Resident

Limiting results to specific locations

I am currently building an app where we have a number of items in a number of sheds, and those sheds are in several different geographic locations.

 

I currently have a list which shows all of the sheds, but I only want our users to see the sheds that are in certain locations.  Is there a way to do this?

 

My current formula to show all the sheds is below.

 

SortByColumns(Search(Barns, TextSearchBox1.Text, "chorus_name"), "chorus_name", If(SortDescending1, Descending, Ascending))

 

Thanks in advance.

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Solution Sage
Solution Sage

Re: Limiting results to specific locations

Where is your data located? SharePoint list? Common Data Service?

Do you have a relationship between the regions and the sheds established in the way you house your data (ie, a LookUp field)?

 

How you answer that will impact the language of a potential solution.

 

That said, from a general perspective, you have a couple of options...

 

1) If you had a Gallery of Regions, you could pick one and navigate to a screen that listed the Sheds for the Region (another Gallery). Once you picked the Shed, you would see the Things related to that shed. In this case,  your Sheds gallery would have a Filter() statement in the Item property that limited it to some chosen Region (either pre-chosen or user-selected from a dropdown). Then the Things Gallery would have a Filter() that limited them to those associated with the chosen Shed.

 

2) If you want to do it all in one statement, you could provide a dropdown for the Region (user-selected) or you could pre-define the Region (perhaps based on the user's location). Then you can use a statement that would show all the items from the sheds in that region. Building from the inside out, that would be:

Filter(Sheds, RegionID = yourRegionSelection)

----gets the sheds in the selected Region

Filter(Things, ShedID In (previousFilterStatement).ShedID)

----gets the Things in any of the Sheds returned by the interior Filter() statement (the first one, above).

 

If that doesn't get you there, post back and give us more information about the structure of your data.

 

 

View solution in original post

7 REPLIES 7
Highlighted
Solution Sage
Solution Sage

Re: Limiting results to specific locations

Where is your data located? SharePoint list? Common Data Service?

Do you have a relationship between the regions and the sheds established in the way you house your data (ie, a LookUp field)?

 

How you answer that will impact the language of a potential solution.

 

That said, from a general perspective, you have a couple of options...

 

1) If you had a Gallery of Regions, you could pick one and navigate to a screen that listed the Sheds for the Region (another Gallery). Once you picked the Shed, you would see the Things related to that shed. In this case,  your Sheds gallery would have a Filter() statement in the Item property that limited it to some chosen Region (either pre-chosen or user-selected from a dropdown). Then the Things Gallery would have a Filter() that limited them to those associated with the chosen Shed.

 

2) If you want to do it all in one statement, you could provide a dropdown for the Region (user-selected) or you could pre-define the Region (perhaps based on the user's location). Then you can use a statement that would show all the items from the sheds in that region. Building from the inside out, that would be:

Filter(Sheds, RegionID = yourRegionSelection)

----gets the sheds in the selected Region

Filter(Things, ShedID In (previousFilterStatement).ShedID)

----gets the Things in any of the Sheds returned by the interior Filter() statement (the first one, above).

 

If that doesn't get you there, post back and give us more information about the structure of your data.

 

 

View solution in original post

Highlighted
Responsive Resident
Responsive Resident

Re: Limiting results to specific locations

Thanks for the information.

 

To be honest that was what I thought would be required, I was hoping to get it all filtered with as few clicks as possible in the app itself.

 

I will go back to the double level of filtering, as per your first suggestion.

 

Thanks.

Highlighted
Solution Sage
Solution Sage

Re: Limiting results to specific locations

The second option certainly reduces the clicks... but it produces the specific output of all Things in all Sheds in the selected Region.

 

In your best user-interaction scenario, what would the behavior look like? The user would click on... what... and what would they get as the result?

Super User
Super User

Re: Limiting results to specific locations

Hi @MattyH,

you can prefilter your dataset before searching it if you have a column called locations, for example.

SortByColumns(Search(Filter(Barns, Location = And(“Paris”,”Rome”,”Chicago”), TextSearchBox1.Text, "chorus_name"), "chorus_name", If(SortDescending1, Descending, Ascending))
Highlighted
Responsive Resident
Responsive Resident

Re: Limiting results to specific locations

As an example, say we have 5 locations, A, B, C, D & E.

I want our users to only be able to see those sheds in locations A, B, and C.

They would then be able to click on the required shed from one of those three areas, and view and eventually edit any and all items within that shed.

The sheds in locations D & E are not required to be shown at all in this app.

Highlighted
Solution Sage
Solution Sage

Re: Limiting results to specific locations

I'd really discourage handling app-level, ad hoc lists of "include this" entries. They are messy to update, and a nightmare to maintain. If it were me, I would add a yes/no field in my data source that represented whether that item should be included in a given app or app group. Tick A, B, and C to be true/yes, and then set your initial Filter() to validate that field:

 

Filter(Locations, IncludeForShedSearch = true)

 

Then filter your Sheds where the LocationID is in that returned set (as discussed, above).

 

Like I said... just how I would do it. YMMV.

Highlighted
Responsive Resident
Responsive Resident

Re: Limiting results to specific locations

@TimRohr,

 

Thanks for the suggestion, but I am not currently in a position where we can add fields to the data source. It may be something we can look at in the future, but not possible at the moment.

Helpful resources

Announcements
Check this Out

Helpful information

Featuring samples like Return to the Workplace and Emergency Response Applications

August 2020 Community Challenge: Can You Solve These?

August 2020 Community Challenge: Can You Solve These?

We're excited to announce our first cross-community 'Can You Solve These?' challenge!

secondImage

Return to Workplace

Reopen responsibly, monitor intelligently, and protect continuously with solutions for a safer work environment.

secondImage

Super Users Coming in August

We are excited for the next Super User season.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (7,396)