Hi @jjboda ,
You have a few things here that need addressing - firstly your Patch is at the bottom and will only work following the error message that the PIN was wrong. Next (as @v-qiaqi-msft points out), you are referring to a table, not a record with checkedout - you have mentioned the selected record here, so I assume it is done from a gallery. Lastly (again pointed out), the ID in SharePoint in 'Vehicle Management' will not be the same ID as that in checkedout and either you have a reference field linking them (or is checkout a collection based on 'Vehicle Management' ???)
I assume your Data collection is going to be used in the future somewhere else in the app. So here is a start
If(
IsBlank(PIN_txt.Text),
Notify(
"Please Enter PIN",
NotificationType.Error
),
With(
{
_Driver:
LookUp(
Drivers,
PIN = PIN_txt.Text
).Driver,
_CheckedOut: YourCheckedOutGallery.Selected
},
If(
IsBlank(_Driver),
Notify(
"Invalid PIN. Please try Again",
NotificationType.Error
),
Collect(
Data,
{
Vehicle: _CheckedOut.Model,
Year: _CheckedOut.Year,
Make: _CheckedOut.Manufacturer.Value,
Date: Now() - (TimeZoneOffset()/60)/24,
Driver: _Driver,
Status: "Checked-Out"
}
);
Patch(
'Vehicle Management',
{
ID: _CheckedOut.YourIDReferenceField,
Status:"Checked-Out"
}
);
Navigate(ConfirmationScreen)
)
)
)
Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.
MVP (Business Applications) Visit my blog Practical Power Apps