cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Zenna121
Regular Visitor

Question about the book a room template

Hello everyone,

 

We want to get started with the Powerapp template named "Book a room".

This template is perfect for what we need, however we have 1 problem with the use of this app.

 

When we try to book a room, all rooms in our tenant shows up. The ideal situation would be that we can choose which rooms they can see. I know you have a lot of variables that you can change, but I'm not into coding. Would making an adress book policy be a solution? 

 

As you can see in the screenshot below these are the 3 rooms/recourses in our tenant. I only want to show the last one.

Any ideas that could help me with this problem.

 

Thanks in advance,

 

Zenna

 

Book a room powerapp.png

1 ACCEPTED SOLUTION

Accepted Solutions
fuzzy_fuzz
Resolver II
Resolver II

To display the last item in a Table or collection you can use the Last() function.

 

Last(AvaliableRoomEmailName)

 

If you want to display a specific item you use LookUp(AvaliableRoomEmailName; Name = "testruimte")

View solution in original post

10 REPLIES 10
fuzzy_fuzz
Resolver II
Resolver II

To display the last item in a Table or collection you can use the Last() function.

 

Last(AvaliableRoomEmailName)

 

If you want to display a specific item you use LookUp(AvaliableRoomEmailName; Name = "testruimte")

Hi @fuzzy_fuzz,

 

Thanks for your fast reply!

 

Can you tell me where I exactly need to place this line of code?

If I replace AvaliableRoomEmailName with LookUp(AvaliableRoomEmailName; Name = "testruimte") I get an error message (see screenshot). 

 

Zenna

fuzzy_fuzz
Resolver II
Resolver II

In the Items property of RoomsGallery. Check your code notation, you might need to replace the separator ";" for ","

Zenna121
Regular Visitor

Hi @fuzzy_fuzz ,

 

Meanwhile it worked for me to show 1 room instead of every room. 

There was a mispronunciation in our conversation, thats why the code didn't work.

Now my last question is how I can show 3 specific rooms?

I know that you can show all, and only 1 specific room, but can you change the code so that I can show like 3 or 4?

 

See example below, this didn't work for me

 

LookUp(AvailableRoomEmailName; Name = "testruimte", "testruimte1")

 

LookUp(AvailableRoomEmailName; Name = "testruimte")

LookUp(AvailableRoomEmailName; Name = "testruimte1")

 

@Zenna121 ,

For that you create a collection of these 3 or 4 rooms.

ClearCollect(
    colRooms; 
    LookUp(AvailableRoomEmailName; Name = "testruimte"); 
    LookUp(AvailableRoomEmailName; Name = "testruimte1");
    LookUp(AvailableRoomEmailName; Name = "testruimte2")
)

This code should go in a OnSelect action, like a button or in the case of "Book a Room" app maybe on a previous gallery.

 

Place colRooms in the Items property of the gallery and you get the 3 Rooms you lookUp.

Hi @fuzzy_fuzz ,

 

Thanks for your reply, I am totally new to Power apps so my experience with Powerapps isn't the greatest.

I copied the code of you and placed it in the OnSelect field of the gallery, but nothing is happening. I don't get an error message or anything (see screenshot).

 

Whenever I try to replace LookUp(AvailableRoomEmailName; Name = "testruimte") with the code you send me, I'm getting error messages (see other screenshot). Sorry for my bad experience with Powerapps, like I said I'm new to it.

@Zenna121 

It works on my end with a freshly openned Book a room app. 

 

fuzzy_fuzz_2-1649343562020.png

I placed the button to put inside the code I put above. I woult place it on the OnSelect of "RoomsListsGallery", a previous gallery that you select berfore the avaliable rooms are displayed:

fuzzy_fuzz_3-1649343842665.png

 

Then in the Items property of "RoomsGallery" put colRooms and it works. If you do it this way you don't even need the button.

fuzzy_fuzz_4-1649344017295.png

 

I hope this helps you. 

 

Hi @fuzzy_fuzz ,

 

To test this I made a freshly book a room app as well.

I get this error when I paste the code in the RoomsListGallery

Any idea why I get this error message?

 

If I understand correctly, colRooms is a new variable right? it can be named anything right?

 

Clearcollect variable.png

When you place multiple functions you have to use the separator ";;" between Navigate and ClearCollect.

 

 

Navigate(RoomSelectScreen; ScreenTransition.None);;
ClearCollect(
    colRooms; 
    LookUp(AvailableRoomEmailName; Name = "testruimte"); 
    LookUp(AvailableRoomEmailName; Name = "testruimte1");
    LookUp(AvailableRoomEmailName; Name = "testruimte2")
)

 

I suggest you follow a basic tutorial to learn this king of things, because they're basic and will save you a lot of time asking. Also almost everything is in the forum, so make a quick search before asking. Setting the language to English might help finding info in the forum.

Helpful resources

Announcements
Power Platform Call June 2022 768x460.png

Power Platform Community Call

Join us for the next call on August 17, 2022 at 8am PDT.

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.

Users online (2,078)