Skip to main content

Notifications

Power Apps - Building Power Apps
Unanswered

Build Button CheckOut for Time Entries

(0) ShareShare
ReportReport
Posted on by

Hi Community. I need help to fix this.

 

I make an application about time entries. But on the checkout button, I get an error. the error message is "
Unexpected characters. The formula contains 'ParenClose' Where 'CurlyOpen' is expected ". My code in Button check out like this.

Patch(
 'Bookable Resources',
 CurrentLogin
 {
 'Bookable Resources'
 }
); 
UpdateContext(
 {
 Duration : Duration + DateDiff(
 DateTimeValue(EndTime),
 DateTimeValue(StartTime),
 Minutes
 )
 }
);
Patch(
 'Bookable Resources',
 CurrentLogin,
 {
 'Bookable Resources'.name
 'Bookable Resources'.Status : "Working"
 {
If(
 Not(IsBlank(End)),
 Patch(
 'Time Entries',
 GalleryTimeEntries.Selected,
 {
 'Work Order Service Task': GalleryServices.Selected,
 End: Now(),
 Duration: DateDiff(
 GalleryTimeEntries.Selected.Start,
 Now(),
 Minutes
 )
 }
 ),
Patch(
 'Time Entries',
 LookUp(
 'Time Entries',
 'Time Entries' = GalleryTimeEntries.Selected.Start
 ),
 {
 End: Now(),
 Duration: DateDiff(
 LookUp(
 'Time Entries',
 'Time Entries' = GalleryTimeEntries.Selected).Start,
 Now(),
 Minutes
 )
 }
 )
)

 

  • BayuChoirul Profile Picture
    BayuChoirul on at
    Re: Build Button CheckOut for Time Entries

    I will try this solution

  • rubin_boer Profile Picture
    rubin_boer 4,806 on at
    Re: Build Button CheckOut for Time Entries

    @BayuChoirul ok in that case you will have to lookup the id for that record, something like 

    Patch(
    'Bookable Resources',
    {ID:Lookup the ID which you want to update or something similar},
    {ColumName: "Value to that column"}
    )

    Have a look at this:

    I created a collection _SomeData

    ClearCollect(_SomeData,{Name: "One", Value: 100, ID: 1})

     
     

    Now to update that collection i will patch it, where the ID is 1

    Patch(_SomeData,{ID:1},{ Value: 200})

     
  • BayuChoirul Profile Picture
    BayuChoirul on at
    Re: Build Button CheckOut for Time Entries

    I didn't try to create a new record. I used an existing record, then I counted the check-in time and check-out time

  • rubin_boer Profile Picture
    rubin_boer 4,806 on at
    Re: Build Button CheckOut for Time Entries

    hi @BayuChoirul 

     

    Are you trying to create a new record? Defaults('Bookable Resources') will replace CurrentLogin 

     

    Patch(
     'Bookable Resources',
     CurrentLogin
     {
     'Bookable Resources'
     }
    ); 

    something like
    Patch(
    'Bookable Resources',
    Defaults('Bookable Resources'),
    {ColumName: "Value to that column"}
    )

     

     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Microsoft Kickstarter Events…

Register for Microsoft Kickstarter Events…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Announcing Forum Attachment Improvements!

We're excited to announce that attachments for replies in forums and improved…

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 145,526

#2
RandyHayes Profile Picture

RandyHayes 76,287

#3
Pstork1 Profile Picture

Pstork1 64,907

Leaderboard