Reset(Inp_Cluster_Drp);
ForAll(
inprogresslis As x,
If(
x.status = "New",
// If the record does not exist, create a new one
Patch(
'FTE Draft Data',
Defaults('FTE Draft Data'),
{
'Employee NO': x.'Employee NO', // Use fields from the gallery item
'Cluster/Function': x.'Cluster/Function',
Program: x.Program,
'Full Name': x.'Full Name',
'Budget Code': x.'Budget Code',
'FTE(%)': x.'FTE(%)',
OriginalEndDate: If(
IsBlank(x.OriginalEndDate) || Len(x.OriginalEndDate) <> 10,
Blank(), // Leave blank if the date format is incorrect
Date(
Value(Mid(x.OriginalEndDate, 7, 4)), // Year
Value(Mid(x.OriginalEndDate, 4, 2)), // Month
Value(Left(x.OriginalEndDate, 2)) // Day
)
),
'Month and Year': x.'Month and Year'
}
),
// If the record exists, update the existing one using ThisRecord directly
Patch(
'FTE Draft Data',
LookUp('FTE Draft Data', ID = x.rowno), // Update the current item in the gallery
{
'Budget Code': x.'Budget Code', // Refer to combo box selection
'FTE(%)': x.'FTE(%)',
OriginalEndDate: If(
IsBlank(x.OriginalEndDate) || Len(x.OriginalEndDate) <> 10,
Blank(), // Leave blank if the date format is incorrect
Date(
Value(Mid(x.OriginalEndDate, 7, 4)), // Year
Value(Mid(x.OriginalEndDate, 4, 2)), // Month
Value(Left(x.OriginalEndDate, 2)) // Day
)
)
}
)
)
);
Refresh('FTE Draft Data');
ClearCollect(FTECollection, 'FTE Draft Data');
// Show success notification after the patch operations
Notify("Records Saved to Draft Successfully", NotificationType.Success, 3000);
Set(vboolflag, true);
Clear(inprogresslis);
please guide me how to fix it.