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

Show available tables

Hello everybody

 

I want to make a reservation app about table reservation. I have the following data table

tables.PNG

 

I want to show the available tables in this gallery based on the time selected on the top. So it should not show tables with an entry in my data source.

reservation.PNG

 

Anybody knows how to solve this?

 

Thanks

 

8 REPLIES 8
Community Support Team
Community Support Team

Re: Show available tables

Hi @katunar ,

Could you please share a bit more about your scenario?

Do you want to filter your Excel table records within your Gallery based on the selected time within the two Dropdown boxes?

Further, do you show availables Tables in your Excel table between the selected times within the two Dropdown box?

 

Based on the needs that you mentioned, I think the Filter function in PowerApps could achieve your needs. I have made a test on my side, please take a try with the following workaround:

1. If you want to filter your Excel table records within your Gallery based on the selected time within the two Dropdown boxes individually:

Set the Items property of the Gallery to following:

Distinct(
Filter( 'YourExcelTable', If( Dropdown1.Selected.Value = "07:00", '07:00' = Blank(), Dropdown1.Selected.Value = "07:30", '07:30' = Blank(), Dropdown1.Selected.Value = "08:00", '08:00' = Blank(), Dropdown1.Selected.Value = "08:30", '08:30' = Blank(), Dropdown1.Selected.Value = "09:00", '09:00' = Blank(), Dropdown1.Selected.Value = "09:30", '09:30' = Blank(), ... ... Dropdown1.Selected.Value = "14:00", '14:00' = Blank() ) || If( Dropdown2.Selected.Value = "07:00", '07:00' = Blank(), Dropdown2.Selected.Value = "07:30", '07:30' = Blank(), Dropdown2.Selected.Value = "08:00", '08:00' = Blank(), Dropdown2.Selected.Value = "08:30", '08:30' = Blank(), Dropdown2.Selected.Value = "09:00", '09:00' = Blank(), Dropdown2.Selected.Value = "09:30", '09:30' = Blank(), ... ... Dropdown2.Selected.Value = "14:00", '14:00' = Blank() ) ),
Table
)

Note: The '07:00', '07:30', '08:00', ... '14:00', represents the Time period column in your Excel table.

 

2. If you want to show available Tables in your Excel table between the selected times within the two Dropdown boxes, I have made a test on my side, please take a try with the following workaround:

Set the OnChange property of the first Dropdown (Dropdown1) and second Dropdown (Dropdown2) to following:

/* <-- Calculate the Time ranges between the selected time value within the two Dropdown boxes */
Clear(TimeRanges); ForAll( FirstN(
[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23],
DateDiff(Time(Value(First(Split(Dropdown1.Selected.Value,":")).Result),Value(Last(Split(Dropdown1.Selected.Value,":")).Result),0),Time(Value(First(Split(Dropdown2.Selected.Value,":")).Result),Value(Last(Split(Dropdown2.Selected.Value,":")).Result),0),Minutes)/30 + 1
), Collect(
TimeRanges,
Text(DateAdd(Today()+Time(Value(First(Split(Dropdown1.Selected.Value,":")).Result),Value(Last(Split(Dropdown1.Selected.Value,":")).Result),0),Value*30,Minutes),"[$-en-US]HH:mm")
) );
/* <-- Filter the available tables from your Excel table based on the TimeRanges collection */
Clear(TableRecords);
ForAll(
TimeRnages,
Colelct(
TableRecords,
Filter(
'YourExcelTable',
If(
Value = "07:00", '07:00' = Blank(),
Value = "07:30", '07:30' = Blank(),
Value = "08:00", '08:00' = Blank(),
Value = "08:30", '08:30' = Blank(),
Value = "09:00", '09:00' = Blank(),
...
...
Value = "14:00", '14:00' = Blank()
)
)
)
)

Set the Items property of the Gallery to following:

Distinct(TableRecords, Table)

Please take a try with above solution, then check if the issue is solved.

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
katunar
Level: Powered On

Re: Show available tables

Hi @v-xida-msft 

thank you for your reply.

I am looking for a filter system that shows me all the tables that are available in the time selected in the 2 dropboxes. So, if I am looking for a table between 09:30 and 10:30, it should show me all the tables with no entries between these 2 times.

 

I used your second formula but it doesn't show me any table, no matter what time I choose.

 

Gallery Items:

Distinct(TableRecords; Table)

Inside the Gallery, I use a label with the following Text:

ThisItem.Result

Am I doing anything wrong? Why is there now table shown?

 

Thank you for your help!

Community Support Team
Community Support Team

Re: Show available tables

Hi @katunar ,

Could you please share a bit more about your app's configuration?

Is there something error with the formula you typed in your app?

 

Please check if the TimeRanges collection has been populated with proper values (09:30, 10:00, 10:30). I have made a test on my side, and don't have the issue that you mentioned.

Please also consider modify your formula as below:

Set the OnChange property of the first Dropdown (Dropdown1) and second Dropdown (Dropdown2) to following:

/* <-- Calculate the Time ranges between the selected time value within the two Dropdown boxes */
Clear(TimeRanges); ForAll( FirstN(
[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23],
DateDiff(Time(Value(First(Split(Dropdown1.Selected.Value,":")).Result),Value(Last(Split(Dropdown1.Selected.Value,":")).Result),0),Time(Value(First(Split(Dropdown2.Selected.Value,":")).Result),Value(Last(Split(Dropdown2.Selected.Value,":")).Result),0),Minutes)/30 + 1
), Collect(
TimeRanges,
Text(DateAdd(Today()+Time(Value(First(Split(Dropdown1.Selected.Value,":")).Result),Value(Last(Split(Dropdown1.Selected.Value,":")).Result),0),Value*30,Minutes),"[$-en-US]HH:mm")
) );
/* <-- Filter the available tables from your Excel table based on the TimeRanges collection */
Clear(TableRecords);
ForAll(
TimeRnages,
Colelct(
TableRecords,
Filter(
'YourExcelTable',
If(
Value = "07:00", IsBlank('07:00'), /* <-- Modify formula here start */
Value = "07:30", IsBlank('07:30'),
Value = "08:00", IsBlank('08:00'),
Value = "08:30", IsBlank('08:30'),
Value = "09:00", IsBlank('09:00'),
...
...
Value = "14:00", IsBlank('14:00') /* <-- Modify formula here end */
)
)
)
)

Please also take a try with above solution, then check if the issue is solved.

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
katunar
Level: Powered On

Re: Show available tables

Hi @v-xida-msft ,

 

I used your formula again and now the gallery shows me the tables.

But the next problem is that it doesn't filter the tables based on the dropdown values. There also seems a problem with the population of the time ranges collection. When I select and reselect values in the dropdown, the older collected values in the TimeRanges collection don't disappear.

 

2.PNG

 

The TableRecords collection looks like this

 

3.PNG

 

And the gallery looks like this

 

1.PNG

 

I used your formula just as you said, but there seems to be some more issues. If you need more information let me know. I hope you can help me with this problem.

 

Thank you

 

 

Community Support Team
Community Support Team

Re: Show available tables

Hi @katunar ,

Have you added the Clear(TimeRanges) formula to clear the TimeRanges collection within your formula?

 

I have made a test on my side, and don't have the issue that you mentioned. Please set the OnChange property and OnSelect property of the first Dropdown (Dropdown1) and second Dropdown (Dropdown2) to following:

/* <-- Calculate the Time ranges between the selected time value within the two Dropdown boxes */
Clear(TimeRanges); ForAll( FirstN(
[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23],
DateDiff(Time(Value(First(Split(Dropdown1.Selected.Value,":")).Result),Value(Last(Split(Dropdown1.Selected.Value,":")).Result),0),Time(Value(First(Split(Dropdown2.Selected.Value,":")).Result),Value(Last(Split(Dropdown2.Selected.Value,":")).Result),0),Minutes)/30 + 1
), Collect(
TimeRanges,
Text(DateAdd(Today()+Time(Value(First(Split(Dropdown1.Selected.Value,":")).Result),Value(Last(Split(Dropdown1.Selected.Value,":")).Result),0),Value*30,Minutes),"[$-en-US]HH:mm")
) );
/* <-- Filter the available tables from your Excel table based on the TimeRanges collection */
Clear(TableRecords);
ForAll(
TimeRanges,
Colelct(
TableRecords,
Filter(
'YourExcelTable',
If(
Value = "07:00", IsBlank('07:00'), /* <-- Modify formula here start */
Value = "07:30", IsBlank('07:30'),
Value = "08:00", IsBlank('08:00'),
Value = "08:30", IsBlank('08:30'),
Value = "09:00", IsBlank('09:00'),
...
...
Value = "14:00", IsBlank('14:00') /* <-- Modify formula here end */
)
)
)
)

Please also take a try with above solution, then check if the issue is solved.

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
katunar
Level: Powered On

Re: Show available tables

Hi @v-xida-msft ,

 

Here is my formula

 

Clear(TimeRanges);;
ForAll(
       FirstN(
                [0;1;2;3;4;5;6;7;8;9;10;11;12;13;14;15;16;17;18;19;20;21;22;23]; 
                DateDiff(Time(Value(First(Split(Dropdown1.Selected.Value;":")).Result);Value(Last(Split(Dropdown1.Selected.Value;":")).Result);0);Time(Value(First(Split(Dropdown1_1.Selected.Value;":")).Result);Value(Last(Split(Dropdown1_1.Selected.Value;":")).Result);0);Minutes)/30 + 1
       );
       Collect(
               TimeRanges; 
               Text(DateAdd(Today()+Time(Value(First(Split(Dropdown1.Selected.Value;":")).Result);Value(Last(Split(Dropdown1.Selected.Value;":")).Result);0);Value*30;Minutes);"[$-de-DE]hh:mm")
       )
);;
Clear(TableRecords);;
ForAll(
       TimeRanges;
       Collect(
               TableRecords;
               Filter(
                      _Day1;
                       If(
                          Value = "08:30"; IsBlank('07:30');
                          Value = "09:00"; IsBlank('08:00');
                          Value = "09:30"; IsBlank('08:30');
                          Value = "10:00"; IsBlank('09:00');
                          Value = "10:30"; IsBlank('09:30');
                          Value = "11:00"; IsBlank('10:00');
                          Value = "11:30"; IsBlank('10:30');
                          Value = "12:00"; IsBlank('11:00');
                          Value = "12:30"; IsBlank('11:30');
                          Value = "13:00"; IsBlank('12:00');
                          Value = "13:30"; IsBlank('12:30');
                          Value = "14:00"; IsBlank('13:00');
                          Value = "14:30"; IsBlank('13:30');
                          Value = "15:00"; IsBlank('14:00');
                          Value = "15:30"; IsBlank('14:30');
                          Value = "16:00"; IsBlank('15:00');
                          Value = "16:30"; IsBlank('15:30');
                          Value = "17:00"; IsBlank('16:00');
                          Value = "17:30"; IsBlank('16:30');
                          Value = "18:00"; IsBlank('17:00')
                       )
               )
       )
)

I added everything just as you said. I have no idea where the error is. I would be very thankful for your help.

katunar
Level: Powered On

Re: Show available tables

Hi @v-xida-msft ,

 

so I just tried your formula again and noticed the main problem. Your formula works correctly if you choose a time span in which a certain table is reserved for all the time. So if you select the time between 08:30 and 11:00, it won't show the tables that are reserved through all the time, which means the tables need to have an entry in the database in every single cell (08:30, 09:00, 09:30, 10:00, 10:30, 11:00). If there is no entry in just a single cell in that time span (08:30, 09:00, 09:30, 10:30, 11:00), the formula will show the table as available.

So the formula shouldn't show the tables that have at least one record in the selected time span.

 

Do you think you can fix this bug? I would be very thankful if you could fix it.

Thank you very much

katunar
Level: Powered On

Re: Show available tables

@v-xida-msft could you please tell me if you can create a solution or not? Thanks.

Helpful resources

Announcements
firstImage

PowerApps Monthly Community Call!

Join us next Wednesday for our Demo Extravaganza, October 16, 2019 8am PDT.

firstImage

Microsoft Business Applications Virtual Launch Event

Join us for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

firstImage

Watch Sessions On Demand!

Continue your learning in our online communities.

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

FirstImage

Power Platform World Tour

Coming to a city near you

thirdimage

PowerApps Community User Group Member Badge

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

FourthImage

Join PowerApps User Group!!

Connect, share, and learn with your peers year-round

SecondImage

Power Platform Summit North America

Register by September 5 to save $200

Top Kudoed Authors
Users Online
Currently online: 189 members 4,360 guests
Please welcome our newest community members: