Var iList, tmpCount: Integer; tmpEntry, tmpFile: String; tmpList: TStringList; Const ctRTCount = 'RT_COUNT'; Begin psVSA := ''; psExitCode:= -2; tmpFile := psFilePath + psFileName; psLogWrite(1, '', 'Searching for ' + ctRTCount + ' inside File: ' + tmpFile); tmpList := TStringList.Create; Try Try tmpList.LoadFromFile(tmpFile); // Count entries tmpCount := tmpList.Count; // Remove empty entries from tmpList object before checking For iList := (tmpCount - 1) Downto 0 Do Begin If Trim(tmpList.Strings[iList]) = '' Then tmpList.Delete(iList); End; // Recount entries tmpCount := tmpList.Count; // Check Last Row If tmpCount > 0 Then Begin // Get last entry > tmpCount-1 because of 0 indexed List tmpEntry := AnsiUpperCase(tmpList.Strings[tmpCount-1]); If pos(ctRTCount, tmpEntry) <> 0 Then Begin psExitCode := 1; // Filter found psLogWrite(1, '', ctRTCount + ' found: ' + tmpEntry); End; End; Except psLogWrite(1, '', 'LoadFromFileError, ' + tmpFile); End; Finally tmpList.Free; End; End.