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

Find free date for device booking app

Hello, I am looking to create a device booking app. I created 3 tables, one for the device informations, one for the upcoming events and one for the m:n relationship. The table for the upcoming events contains the start and the end of the event. It also contains the devices needed for the event (typed in manually). Now I would like to implement some logic that shows which device is available in a specific time space I can choose by myself. Has anybody an idea?

1 ACCEPTED SOLUTION

Accepted Solutions
Rebetcha
Level 10

Re: Find free date for device booking app

Ok, thanks.

 

Before I go any further: Excel is a non-delegable data source (see for more information the PowerApps documentation about delegation). That means that all your data is loaded into the app before any filtering is done. PowerApps only gets the first 500 items (you can increase this to a max of 2000) and than does filtering on that set. 

 

Regardless of the data source - the sollution is more or less the same. 

  1. Add a gallery to show the devices
  2. Instead of simply using the devices table as the data source of the gallery, use a filtered subset of the devices table as a data source:
    • Use the Filter function to build a filter formula using all your tables and the Start en End of the Events table. 
    • Use the Not or ! to exclude Devices that are connected to events within the time span

Your formula will look something like this:

Filter( 
    DevicesList,
    Not(
        DeviceID in ( 
			Filter(
				RelationShipList, EventID in 
					Filter(EventList, Or(StartDate >= StartDateOfCurrentEvent && StartDate <= EndDateOfCurrentEvent, EndData >= StartDateOfCurrentEvent && EndData <= EndDateOfCurrentEvent)).EventID
			)).DeviceID
    )
)

View solution in original post

4 REPLIES 4
Rebetcha
Level 10

Re: Find free date for device booking app

Hi @katunar ,

 

Before I dig deeper into your question: what data source do you use??

katunar
Level: Powered On

Re: Find free date for device booking app

I am using an excel document in one drive
Rebetcha
Level 10

Re: Find free date for device booking app

Ok, thanks.

 

Before I go any further: Excel is a non-delegable data source (see for more information the PowerApps documentation about delegation). That means that all your data is loaded into the app before any filtering is done. PowerApps only gets the first 500 items (you can increase this to a max of 2000) and than does filtering on that set. 

 

Regardless of the data source - the sollution is more or less the same. 

  1. Add a gallery to show the devices
  2. Instead of simply using the devices table as the data source of the gallery, use a filtered subset of the devices table as a data source:
    • Use the Filter function to build a filter formula using all your tables and the Start en End of the Events table. 
    • Use the Not or ! to exclude Devices that are connected to events within the time span

Your formula will look something like this:

Filter( 
    DevicesList,
    Not(
        DeviceID in ( 
			Filter(
				RelationShipList, EventID in 
					Filter(EventList, Or(StartDate >= StartDateOfCurrentEvent && StartDate <= EndDateOfCurrentEvent, EndData >= StartDateOfCurrentEvent && EndData <= EndDateOfCurrentEvent)).EventID
			)).DeviceID
    )
)

View solution in original post

Highlighted
katunar
Level: Powered On

Re: Find free date for device booking app

Thank you very much, it helped me a lot and works fine.

Helpful resources

Announcements
thirdimage

Power Automate 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

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

Top Kudoed Authors
Users Online
Currently online: 162 members 6,196 guests
Please welcome our newest community members: