The 1st part wherein when a record was being submitted, it checks and patch existing rows (Site Asset Services) matching the submitted row (PMS form)
2. AV_Credentials - sometimes null/blank
AssetRecord = Site_Asset_Services[SOR_No == input.SOR2 && Type_of_System == "AV System"];
if(AssetRecord.count() > 0)
{
// ---- UPDATE PATH ----
for each rec in AssetRecord
{
subformRows = rec.Site_Asset;
matchedKeys = list();
for each row1 in subformRows
{
for each Final_Rec in input.AV_System
{
if(Final_Rec.AV_Status != row1.Status || Final_Rec.AV_Remarks != row1.Remarks || Final_Rec.AV_IP_Address != row1.IP_Address || Final_Rec.AV_Serial_N != row1.Serial_N)
{
row1.IP_Address=Final_Rec.AV_IP_Address;
row1.Credentials=Final_Rec.AV_Credentials;
row1.Serial_N=Final_Rec.AV_Serial_N;
row1.Status=Final_Rec.AV_Status;
row1.Remarks=Final_Rec.AV_Remarks;
keys = Final_Rec.AV_Floor + "|" + Final_Rec.AV_Room_Name + "|" + Final_Rec.AV_Brand + "|" + Final_Rec.AV_Model + "|" + Final_Rec.AV_Serial_N + "|" + Final_Rec.AV_Description + "|" + Final_Rec.AV_IP_Address + "|" + Final_Rec.AV_Credentials + "|" + Final_Rec.AV_Status + "|" + Final_Rec.AV_Remarks;
matchedKeys.add(keys);
}
}
}
...}
Happy to hear your thoughts.