Showing results for 
Search instead for 
Did you mean: 
Post Prodigy
Post Prodigy

another scenario - patch one 1 slot taken and also able to return back and user email - how to??



I have another issue 

I have two list - admin list to input the total of slot available and track

user list when user book or unbook the slot.


A is an input box, - to default as 1

how to patch slot take that is 1 to admin list and B will should the reminder out of the total 


when the user click unbook, this record should delete and return the 1 slot back to the total of the admin list and remove the slot taken; user record should be removed in the user list too?

Do I need to set Variable somewhere? 

Patch(Admin,  {NumberofSlotTaken: NumberofSlotTaken - inputtextA.text});

Patch('user, Defaults('user'), {Title: Title.text, NumberofSlotTaken: ...});


Also how to patch by the reservedby - user email into the list?  It's Person/Group field in SP list.  








hi @v-albai-msft Allen,


Thank you it work -few problems


1) the department is not pick from o365 connector?  Department list is text


2) the patch book and unbook hv some errors?  

3) when unbook the display  4 of 5  should show as 5 of  5 again - how to?




Also how to close the book and unbook button - user are only allow to book 1 time and unbook  1 time ; on unbook the book button will open again thx

Can you kindly advise 

Hi @bbsin 

1. To get the Department, you need to use the Office365Users connector. Then try formula like this:

(must add Office365Users connector first)

{'@odata.type':  "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedUser",
Claims: "i:0#.f|membership|" & User().Email,
DisplayName: User().FullName,
Email: User().Email,
Department: Office365Users. UserProfile (User().Email).Department,
JobTitle: "",
Picture: ""


2. Try this formula to update the Number inside your patch function:

{NumberofSlotTaken:LookUp(AdminEventInfo,Title=ThisItem.Title). NumberofSlotTaken-Value(InputSlot.Text)}


3. Seems that you are using formula like below to show results like “4 of 5” or “5 of 5 ”:

Text(ThisItem. NumberofSlotTaken ) & " of " & Text(ThisItem. TotalofSlots )

 so for unbook button, you can directly update this NumberofSlotTaken to make it add 1:

{NumberofSlotTaken:LookUp(AdminEventInfo,Title=ThisItem.Title). NumberofSlotTaken+1}


4. Set OnVisible property of your screen to:




For unbook button, set its Visible property to:


And set OnSelect property of unbook to:



For book button, set its Visible property to:

If(varDisplay=1,true ,false)

And set OnSelect property of book to:


Best regards,


Hi @v-albai-msft 


it is working but the department is still not pickup into the SP List?






I change to person/group also cannot

do I need to change the SP List to Person / Group ?


2) When I click the book button ;it closed all the rest in the gallery?


I click on the unbook for the 2nd item it return to the first.. as I booked first event1 .. just trying out.. 

How to just book and unbook the row of record?

and also sort the item by date and running time descending?   








Hi @bbsin ,

If the Department column is another Text column, you also need to update it in your code, like:





} )

Best regards,


Hi @v-albai-msft 


sorry don't quite get it.


I changed the department to Person/ Group in SP list




the book button on PAs


All is working fine expect the department not picking.


Also How to only book and unbook this row records not the entire gallery?  Thx  Now when I click it is for the entire gallery.


Do I put thisitem. ID somewhere?  Thx

Hi @bbsin ,

If you want to update with the department, don't use the Person column, just use a Text column. See my example, here Department is a Text column:

Patch(list9,Defaults(list9),{Title:"test0701",Department:Office365Users. UserProfile (User().Email).Department})



Best regards,


Hi Allen @v-albai-msft 


There no error in your syntax, but not sure why the list is not picking it?

It's Text in SPlist




I have a label in PowerApps  front screen and it using as label - Office365Users.MyProfile().Department and it display

NOt sure what wrong.. thx

@v-albai-msft  - hi Allen, can you help with the two issue?   Thanks 


Hi @v-albai-msft 


Also how to book and unbook only the row of record not the whole gallery?  Now when I click the book or unbook it affect the whole gallery.  THx

Helpful resources

Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Community Call Conversations

Introducing the Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Top Kudoed Authors
Users online (2,965)