UI Script drops first line

SOLVED

Experts,

I have a complex script that fires on the Panel PostLoad event of PLINES in SO Entry. The script colors lines based on some conditions and works great. It is based on a script that I got from a ScriptingClass a few years ago. The issue with my script (as well as the example script) is that it will drop the first line item on a new order. An existing order that has been saved before will drop the first new line if you add additional lines. The script loops through the lines.

Does anyone know how to prevent this behavior?

I already tried using the following to set the focus back to the proper line after the loop:

sLoadKey = oLines.GetKey()
...LOOP...
retVal = oLines.SetKey(sLoadKey)


Thanks,

Bastian