cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
bbsin
Post Prodigy
Post Prodigy

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

Hi

 

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.  

 

Thanks

 

1.PNG

 

 

17 REPLIES 17

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?

1.PNG

 

 

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)

ReservedBy:
{'@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:

Set(varDisplay,1)

valbaimsft_0-1624952388817.png

 

For unbook button, set its Visible property to:

If(varDisplay=1,false,true)

And set OnSelect property of unbook to:

Set(varDisplay,1)

 

For book button, set its Visible property to:

If(varDisplay=1,true ,false)

And set OnSelect property of book to:

Set(varDisplay,0)

Best regards,

Allen

View solution in original post

Hi @v-albai-msft 

 

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

 

bbsin_0-1625102762706.pngbbsin_1-1625102787663.png

bbsin_2-1625102819456.png

bbsin_0-1625114253729.png

 

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?

bbsin_3-1625105469289.png

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?   

 

Thanks

bbsin_4-1625105549781.png

 

 

 

Thanks 

Hi @bbsin ,

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

Patch(listname,Defaults(listname),{

Department:Office365Users.UserProfile(User().Email).Department,

EventStart:Now(),

....

} )

Best regards,

Allen

Hi @v-albai-msft 

 

sorry don't quite get it.

 

I changed the department to Person/ Group in SP list

bbsin_0-1625115046604.png

 

 

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})

valbaimsft_0-1625119687342.png

valbaimsft_1-1625119700706.png

Best regards,

Allen

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

Announcements
PA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

Power Query PA Forum 768x460.png

Check it out!

Did you know that you can visit the Power Query Forum in Power BI and now Power Apps

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

R2 (Green) 768 x 460px.png

Microsoft Dynamics 365 & Power Platform User Professionals

DynamicsCon is a FREE, 4 half-day virtual learning experience for 11,000+ Microsoft Business Application users and professionals.

Users online (1,420)