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
)
}
)
)
I will try this solution
@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})
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
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"}
)