...
The Configuration Key in the EXE is SearchYMilisecondsAfterEvent by default is 0
If the result of the SELECT TOP 1 VALUE FROM tblPLC_3 = 1 then set the equipmentID=2, CauseID=539, Detail=PI.
If the result <> 1 then repeat the process with the next Priority in the list.