cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
davidstone
Level 8

Re: Count a Variable up

Struggling a bit to visualise what your setup looks like.

 

What are you trying to achieve at a high level? I did an app recently for booking seats at sessions, where I had a number of sessions each with a set number of spaces, and I was able to count the number of bookings (each booking was an item in a list with the session reference) and deduct that from the number of spaces the session held.

 

It seems like you're using individual columns to count the booked seats?

Belasor
Level: Powered On

Re: Count a Variable up

Currently I´m trying to create a booking app to book seats.

And I´m storing the information into a sharepoint list. Everytime you book seats one of the value will be set to true. 

And yes I´m using 1 column for 1 seat.

 

I can´t follow your solution really. Which data storage did you use?

davidstone
Level 8

Re: Count a Variable up

I'm using SharePoint too. I have two lists.

  1. Sessions - a list of bookable sessions that includes an ID, and then the location, timing, and capacity for that event.
  2. Bookings - a list I write to with just the booking individual's email, and the session ID

 

In my app I have a gallery listing the sessions. Each row in the gallery counts the number of entries in Bookings that match the session ID of the current row - which gives me a total number of bookings. I also know how many spaces there were, so can deduct the booked spaces from the total spaces to show how many are left.

 

Also in each row is a 'Book now' button which takes the user to a confirmation page. On that page is a hidden form that defaults to the user's email and the ID of the session they booked on, so when the form submits, their booking is captured.

JRaasumaa
Level 10

Re: Count a Variable up


@Belasor wrote:

Currently I´m trying to create a booking app to book seats.

And I´m storing the information into a sharepoint list. Everytime you book seats one of the value will be set to true. 

And yes I´m using 1 column for 1 seat.

 

I can´t follow your solution really. Which data storage did you use?


 

Could you post the exact code for your button press so we can see what you currently are doing to increment your variable?

Highlighted
Belasor
Level: Powered On

Re: Count a Variable up

First of all thank you both for your answers.

@davidstone I have only one List but containing every column I need. So my solution is a bit different I think. We have some rooms here left which are empty and to give the them a better overview which room is free and which is booked by a person they can book them over the app. The rooms are all stored in the SP List, including the session.

 

@JRaasumaa it´s really a huge piece of code. There is a lot of potential to write that smaller, however it´s my first time do this so don´t be to hard to me :D.

I have a slider with the value to book the available seats. And with the confirm button you can just book the seat.

But have a closer look:

Switch( Slider1.Value, 
1, Switch(ThisItem.number_x0020_of_x0020_seats-ThisItem.taken_x0020_places, 
 1,If(seat1=false,Patch('3floor_1',Gallery4.Selected,{seat1:true}),If(seat2=false,Patch('3floor_1',Gallery4.Selected,{seat2:true}),If(seat3=false,Patch('3floor_1',Gallery4.Selected,{seat3:true}),If(seat4=false,Patch('3floor_1',Gallery4.Selected,{seat4:true}),If(seat5=false,Patch('3floor_1',Gallery4.Selected,{seat5:true}),If(seat6=false,Patch('3floor_1',Gallery4.Selected,{seat6:true}))))))),
 2,If(seat1=false,Patch('3floor_1',Gallery4.Selected,{seat1:true}),If(seat2=false,Patch('3floor_1',Gallery4.Selected,{seat2:true}),If(seat3=false,Patch('3floor_1',Gallery4.Selected,{seat3:true}),If(seat4=false,Patch('3floor_1',Gallery4.Selected,{seat4:true}),If(seat5=false,Patch('3floor_1',Gallery4.Selected,{seat5:true}),If(seat6=false,Patch('3floor_1',Gallery4.Selected,{seat6:true}))))))),
 3,If(seat1=false,Patch('3floor_1',Gallery4.Selected,{seat1:true}),If(seat2=false,Patch('3floor_1',Gallery4.Selected,{seat2:true}),If(seat3=false,Patch('3floor_1',Gallery4.Selected,{seat3:true}),If(seat4=false,Patch('3floor_1',Gallery4.Selected,{seat4:true}),If(seat5=false,Patch('3floor_1',Gallery4.Selected,{seat5:true}),If(seat6=false,Patch('3floor_1',Gallery4.Selected,{seat6:true}))))))),
 4,If(seat1=false,Patch('3floor_1',Gallery4.Selected,{seat1:true}),If(seat2=false,Patch('3floor_1',Gallery4.Selected,{seat2:true}),If(seat3=false,Patch('3floor_1',Gallery4.Selected,{seat3:true}),If(seat4=false,Patch('3floor_1',Gallery4.Selected,{seat4:true}),If(seat5=false,Patch('3floor_1',Gallery4.Selected,{seat5:true}),If(seat6=false,Patch('3floor_1',Gallery4.Selected,{seat6:true}))))))),
 5,If(seat1=false,Patch('3floor_1',Gallery4.Selected,{seat1:true}),If(seat2=false,Patch('3floor_1',Gallery4.Selected,{seat2:true}),If(seat3=false,Patch('3floor_1',Gallery4.Selected,{seat3:true}),If(seat4=false,Patch('3floor_1',Gallery4.Selected,{seat4:true}),If(seat5=false,Patch('3floor_1',Gallery4.Selected,{seat5:true}),If(seat6=false,Patch('3floor_1',Gallery4.Selected,{seat6:true}))))))),
 6,If(seat1=false,Patch('3floor_1',Gallery4.Selected,{seat1:true}),If(seat2=false,Patch('3floor_1',Gallery4.Selected,{seat2:true}),If(seat3=false,Patch('3floor_1',Gallery4.Selected,{seat3:true}),If(seat4=false,Patch('3floor_1',Gallery4.Selected,{seat4:true}),If(seat5=false,Patch('3floor_1',Gallery4.Selected,{seat5:true}),If(seat6=false,Patch('3floor_1',Gallery4.Selected,{seat6:true})))))))),

2, Switch(ThisItem.number_x0020_of_x0020_seats-ThisItem.taken_x0020_places, 
 1,"",
 2,If(seat1=false,Patch('3floor_1',Gallery4.Selected,{seat1:true},{seat2:true})),
 3,If(seat1=false,Patch('3floor_1',Gallery4.Selected,{seat1:true},{seat2:true}),If(seat2=false,Patch('3floor_1',Gallery4.Selected,{seat2:true},{seat3:true}))),
 4,If(seat1=false,Patch('3floor_1',Gallery4.Selected,{seat1:true},{seat2:true}),If(seat2=false,Patch('3floor_1',Gallery4.Selected,{seat2:true},{seat3:true}),If(seat2=false,Patch('3floor_1',Gallery4.Selected,{seat3:true},{seat4:true})))),
 5,If(seat1=false,Patch('3floor_1',Gallery4.Selected,{seat1:true},{seat2:true}),If(seat2=false,Patch('3floor_1',Gallery4.Selected,{seat2:true},{seat3:true}),If(seat3=false,Patch('3floor_1',Gallery4.Selected,{seat3:true},{seat4:true}),If(seat2=false,Patch('3floor_1',Gallery4.Selected,{seat4:true},{seat5:true}))))),
 6,If(seat1=false,Patch('3floor_1',Gallery4.Selected,{seat1:true},{seat2:true}),If(seat2=false,Patch('3floor_1',Gallery4.Selected,{seat2:true},{seat3:true}),If(seat3=false,Patch('3floor_1',Gallery4.Selected,{seat3:true},{seat4:true}),If(seat4=false,Patch('3floor_1',Gallery4.Selected,{seat4:true},{seat5:true}),If(seat2=false,Patch('3floor_1',Gallery4.Selected,{seat5:true},{seat6:true}))))))),

 
3, Switch(ThisItem.number_x0020_of_x0020_seats-ThisItem.taken_x0020_places, 
 1,"",
 2,"",
 3,If(seat1=false,Patch('3floor_1',Gallery4.Selected,{seat1:true},{seat2:true},{seat3:true})),
 4,If(seat1=false,Patch('3floor_1',Gallery4.Selected,{seat1:true},{seat2:true},{seat3:true}),If(seat2=false,Patch('3floor_1',Gallery4.Selected,{seat2:true},{seat3:true},{seat4:true}))),
 5,If(seat1=false,Patch('3floor_1',Gallery4.Selected,{seat1:true},{seat2:true},{seat3:true},If(seat2=false,Patch('3floor_1',Gallery4.Selected,{seat2:true},{seat3:true},{seat4:true}),If(seat3=false,Patch('3floor_1',Gallery4.Selected,{seat3:true},{seat4:true},{seat5:true}))))),
 6,If(seat1=false,Patch('3floor_1',Gallery4.Selected,{seat1:true},{seat2:true},{seat3:true},If(seat2=false,Patch('3floor_1',Gallery4.Selected,{seat2:true},{seat3:true},{seat4:true}),If(seat3=false,Patch('3floor_1',Gallery4.Selected,{seat3:true},{seat4:true},{seat5:true}),If(seat4=false,Patch('3floor_1',Gallery4.Selected,{seat4:true},{seat5:true},{seat6:true}))))))),
4, Switch(ThisItem.number_x0020_of_x0020_seats-ThisItem.taken_x0020_places, 
 1,"",
 2,"",
 3,"",
 4,If(seat1=false,Patch('3floor_1',Gallery4.Selected,{seat1:true},{seat2:true},{seat3:true},{seat4:true})),
 5,If(seat1=false,Patch('3floor_1',Gallery4.Selected,{seat1:true},{seat2:true},{seat3:true},{seat4:true}),If(seat2=false,Patch('3floor_1',Gallery4.Selected,{seat2:true},{seat3:true},{seat4:true}),If(seat3=false,Patch('3floor_1',Gallery4.Selected,{seat3:true},{seat4:true},{seat5:true})))),
 6,If(seat1=false,Patch('3floor_1',Gallery4.Selected,{seat1:true},{seat2:true},{seat3:true},{seat4:true}),If(seat2=false,Patch('3floor_1',Gallery4.Selected,{seat2:true},{seat3:true},{seat4:true}),If(seat3=false,Patch('3floor_1',Gallery4.Selected,{seat3:true},{seat4:true},{seat5:true}),If(seat4=false,Patch('3floor_1',Gallery4.Selected,{seat4:true},{seat5:true},{seat6:true})))))),
5, Switch(ThisItem.number_x0020_of_x0020_seats-ThisItem.taken_x0020_places, 
 1,"",
 2,"",
 3,"",
 4,"",
 5,If(seat1=false,Patch('3floor_1',Gallery4.Selected,{seat1:true},{seat2:true},{seat3:true},{seat4:true})),
 6,If(seat1=false,Patch('3floor_1',Gallery4.Selected,{seat1:true},{seat2:true},{seat3:true},{seat4:true},{seat5:true}),If(seat2=false,Patch('3floor_1',Gallery4.Selected,{seat1:true},{seat2:true},{seat3:true},{seat4:true},{seat5:true})))),
 
6, Switch(ThisItem.number_x0020_of_x0020_seats-ThisItem.taken_x0020_places, 
1,"",
2,"",
3,"",
4,"",
5,"",
6,If(seat1=false,Patch('3floor_1',Gallery4.Selected,{seat1:true},{seat2:true},{seat3:true},{seat4:true},{seat5:true},{seat6:true})))
)
;If(seat1=true,UpdateContext({_varseatstaken:_varseatstaken+1}));If(seat2=true,UpdateContext({_varseatstaken:_varseatstaken+1}));If(seat3=true,UpdateContext({_varseatstaken:_varseatstaken+1}));If(seat4=true,UpdateContext({_varseatstaken:_varseatstaken+1}));If(seat5=true,UpdateContext({_varseatstaken:_varseatstaken+1}));If(seat6=true,UpdateContext({_varseatstaken:_varseatstaken+1}))

;Patch('Seating Plan Mannheim',Gallery4.Selected,{taken_x0020_places:_varseatstaken})
;Refresh('Seating Plan Mannheim')&&Refresh('3floor_1')

Thank you

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 (Last 30 Days)
Users online (7,052)