You can do this with two (one for the post-load event and one for the table events) scripts or one script using the following.
The following will work if you create a single script file and attach it to the detail's post-read/post-validate and the library's lines and linesw post-load events.
It will handle the different references between the object handles passed into it from the BOI.
You can see in the attached image how it worked.
I have the following attached to the detail post-read, detail item code post-validate (v2018), and lines post-load.
```
If oScript.UIObj > 0 Then
nRowInLoop = 0
nOldRow = 0 : oSession.AsObject(oScript.UIObj).GetControlProperty ""GD_Lines"", ""Row"", nOldRow
nOldCurrentRow = 0 : oSession.AsObject(oScript.UIObj).GetControlProperty ""GD_Lines"", ""CurrentRow"", nOldCurrentRow
nOldColumn = 0 : oSession.AsObject(oScript.UIObj).GetControlProperty ""GD_Lines"", ""Column"", nOldColumn
nOldCurrentColumn = 0 : oSession.AsObject(oScript.UIObj).GetControlProperty ""GD_Lines"", ""CurrentColumn"", nOldCurrentColumn
Set oLinesObj = oBusObj
If InStr(UCase(oScript.GetCurrentProcedure()), ""POSTLOAD"") > 0 Then
Set oLinesObj = oSession.AsObject(oBusObj.Lines)
oSession.AsObject(oLinesObj.ScriptObject).DeactivateProcedure ""*ALL*""
sCurrentLineKey = """" : oLinesObj.GetValue ""LineKey$"", sLineKey
sCurrentEditKey = """" : sCurrentEditKey = oLinesObj.GetEditKey(sCurrentLineKey)
oLinesObj.MoveFirst
nRowInLoop = 1
Else
nRowInLoop = CInt(nOldRow)
End If
bLinesProcessed = False
Do Until bLinesProcessed
bRowMeetsCriteria = False
sCriteria = """"
sItemCode = """" : oLinesObj.GetValue ""ItemCode$"", sItemCode
If sItemCode = ""ARS-9101"" Then bRowMeetsCriteria = True
oScript.DebugPrint ""bRowMeetsCriteria: "" & bRowMeetsCriteria
If bRowMeetsCriteria Then
oSession.AsObject(oScript.UIObj).SetControlProperty ""GD_Lines"", ""Row"", nRowInLoop
oSession.AsObject(oScript.UIObj).SetControlProperty ""GD_Lines"", ""Column"", 0
oSession.AsObject(oScript.UIObj).SetControlProperty ""GD_Lines"", ""BackColor$"", ""Light Red""
oSession.AsObject(oScript.UIObj).SetControlProperty ""GD_Lines"", ""Row"", nOldRow
oSession.AsObject(oScript.UIObj).SetControlProperty ""GD_Lines"", ""CurrentRow"", nOldCurrentRow
oSession.AsObject(oScript.UIObj).SetControlProperty ""GD_Lines"", ""Column"", nOldColumn
oSession.AsObject(oScript.UIObj).SetControlProperty ""GD_Lines"", ""CurrentColumn"", nOldCurrentColumn
End If
If InStr(UCase(oScript.GetCurrentProcedure()), ""POSTLOAD"") > 0 Then
nRowInLoop = nRowInLoop + 1
oLinesObj.MoveNext
bLinesProcessed = CBool(oLinesObj.EoF)
Else
bLinesProcessed = True
End If
Loop
If InStr(UCase(oScript.GetCurrentProcedure()), ""POSTLOAD"") > 0 Then
oLinesObj.EditLine sCurrentEditKey
oSession.AsObject(oLinesObj.ScriptObject).ActivateProcedure ""*ALL*""
End If
Set oLinesObj = Nothing
End If
```