cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
ilanos
Level: Powered On

Book a Room Template

Hello,

 

Is it possible to filter Rooms by location?  Currently, all Rooms from all locations are displayed.  Trying to narrow search to a particular location.

 

Thanks,

 

Isaac

6 REPLIES 6
ilanos
Level: Powered On

Book a Room Template

 
Anonymous
Not applicable

Re: Book a Room Template

Hi @ilanos

 

Everything is posible.

 

You can have a Input box where users can type location or dropdown with all avaialble locations.

 

For dropdown to show all avaialbe locations put his in Dropdown.Items:

Distinct( YourRoomDataSource, LocationField )

Now in the Gallery filter it by that Dropdown (or user input)

ilanos
Level: Powered On

Re: Book a Room Template

Could you provide the syntax for filtering user Input?

 

This is what I have:

 

Filter(AvailableRoomName, TextInput2)

ilanos
Level: Powered On

Re: Book a Room Template

This Filter worked for me: Filter(AvailableRoomEmailName, StartsWith(Name, TextInput1.Text))

 

 

My only issue is that you have to click on the More Rooms button until the default Room is displayed.  The page is blank until you keep clicking the more rooms button in order to get to the default Room.  How do I Filter so that when you run the app it automatically filters the default Room?

 

 

Thanks,

Ankur
Level: Powered On

Re: Book a Room Template

Sorry for bumping in old thread but have you found out a solution to this? I want to add a location field filtered to my country in meeting app. 

KroonOfficeSol
Level 10

Re: Book a Room Template

Oke, in this case you can use to formulas two easy filter the datasource: Search() and Filter

 

Search

Search you can use when you use a textinput to add a part off the string you want to filter on. In the search filter you can specify the columns (this can be multiple) which has to be evaluated based on the input string. Formula:

Search(Datasource, Textimput.Text, column1, column2, etc)

Filter

Filter you can best use when you want to filter a dataset on a int or specific fullstring (with fullstring I mean that the string to filter is complete and can be matched by the column you want to filter). Filter is great on filtering relationship in a sql database or when you have a choices list where the choices are limited. Practically you wil use a Filter when you use a combobox/list/dropdown control, where the output is a unique number.

 

With a Filter you can filter on more conditions, but for each condition you add a seperate line (where Search takes in one textstring an eveluate more columns). Filters we can build so the return records are blank when the combobox is blank or to show al when the combobox is blank.

 

Show no record on blank combobox

Filter(Datasource
,relationship1ID = Combobox1.selected.ID
,relationship2ID = Combobox2.selected.ID
,etc.
)

Show all record on blank

Filter(Datasource
,IsBlank(Combobox1.selected.ID) || relationship1ID = Combobox1.selected.ID
,IsBlank(Combobox2.selected.ID) || relationship2ID = Combobox2.selected.ID
,etc.
)

To go into the second option (Show all records): How the filter works is that it evalutes every condition line and passes the record if the condition line is true. So if the combobox has no selection the IsBlank() part is true. If there is a selection the IsBlank() part is false and the second part off the condition line is evaluated. Is there a match then the second part is true. Hope this makes sense.

 

Search and Filter

We can also combine both in one formula. 

Search(Filter(Datasource
,IsBlank(Combobox1.selected.ID) || relationship1ID = Combobox1.selected.ID
,IsBlank(Combobox2.selected.ID) || relationship2ID = Combobox2.selected.ID
,etc.
)
,Textinput.Text
,Column1
,Column2,
,etc.
)

What's great is that both formula's are delegated to the server (offcourse when the evaluation syntax is build correctly), so the return collection can be up to 2000 records if needed.

 

Bonus

In this example we talk about a combobox or textinput field. This is great but just as easy we can use a variable in our Filter or Search. Because you can pass variables to the screen in the navigation() formula (in the context part) this is super easy to build. Do like:

Navigate(ToScreen, Cover, {Variable:value you want to put in the variable}) 

 

Then on the hidden property off the ToScreen you reset the variable to blank. Like:

UpdateContext({Variable:Blank()})

 

If you then go to the screen for another part off you're app and don't add a variable in the navigate() formula. So like:

Navigate(ToScreen,Cover)

The datasource is not filtered. This because you have added the following syntax to your filter:

,IsBlank(Variable) || VariableID = Variable

 

This way you can create re-usable screen, which can adept to the user, his role and his privileges. I have a playlist with several short video's on how to do this and posted this on youtube. If you want to see this follow this link: PowerApp - Re-Use Screens

Helpful resources

Announcements
thirdimage

Power Apps Super User Class of 2020

Check it out!

thirdimage

Power Apps Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

SecondImage

Difinity Conference

The largest Power BI, Power Platform, and Data conference in New Zealand

Top Solution Authors
Top Kudoed Authors (Last 30 Days)
Users online (5,215)