Hi everyone,
I need some assistance to see if my scenario can be obtained. I figure it can, but the solution has eluded me. I have an app that has a check-in log and a check-out log. Currently, I have two different sharepoint lists (One for each) that drive the app, but I want to find a way to have one sharepoint list with a Check-in column and Check-out column. Everything is driven by a unique identifier that will be scanned by a barcode scanner. The app is built and functioning great with the two sharepoint lists, but I am having issues with the "OnSelect" property of a button that needs to write to the sharepoint list in the combined scenario.
My sharepoint list (Checkin/Checkout Log) is as follows:
| ScanCode | CheckinDate_Time | CheckoutDate_Time |
| 2023-1234 | 2/23/2024 13:57 | 2/25/2024 08:14 |
2023-1456 | 2/24/2024 15:10 | |
| 2023-1478 | 2/24/2024 16:27 |
I have other button that trigger a process to remove any scanned duplicates from the collections and you will then see I bring back the other columns that are not the unique identifier. The issue I am running into is the second part of the code below. I want the code to count the rows of the SharePoint list by filtering by the unique identifiers and if the CheckoutDate_Time is blank. If the total returned row count is greater than zero, then patch the checkoutDate_Time only, otherwise (count rows returns zero) write the scancode and the checkinDate_Time.
I think I am missing a way when the count returns a total greater than zero, a way to write to that specific record, but I can't seem to wrap my head around that. Any help would be appreciated.
ClearCollect(
colScansCleanCollection,
AddColumns(
RenameColumns(
colScansdistincttest,
"Value",
"scancode_renamed"
),
"scancode",
LookUp(colScanstest, scancode_renamed = scancode).scancode,
"scantime",
LookUp(colScanstest, scancode_renamed = scancode).scantime
));
If(
ForAll(
colScansCleanCollection,
Countrows(
Filter(
'Checkin/Checkout Log',
ScanCode = scancode || IsBlank(CheckoutDate_Time)
)) > 0),
Patch(
'Checkin/Checkout Log',
Defaults('Checkin/Checkout Log'),
{
ScanCode: scancode,
CheckoutDate_Time: scantime
}
),
Patch(
'Checkin/Checkout Log',
Defaults('Checkin/Checkout Log'),
{
ScanCode: scancode,
CheckinDate_Time: scantime,
Title: "Checkin/Checkout Log"
}
)
);
Clear(colScanstest);
Clear(colScansdistincttest);
Clear(colScansCleanCollection);
UpdateContext({ShowPopUp: false});

Report
All responses (
Answers (