lcReplaceCmd = 'REPLACE ' + lcControlSource + ' IN (lcCursorName) WITH (lcNewValue) ; FOR RECNO() = lnRow AND EMPTY(EVAL("' + lcControlSource + '"))'. * lcReplaceCmd resolves to a sting housing cmd * REPLACE FI.REF IN (lcCursorName) WITH (lcNewValue) ;FOR RECNO() = lnRow AND EMPTY(EVAL("FI.REF")) *-- equal to * REPLACE FI.REF IN (lcCursorName) WITH (lcNewValue) ;FOR RECNO() = lnRow AND EMPTY(FI.REF)so only empy values are to be replaced in original code.
IF VARTYPE(EVAL(lcControlSource)) = "C" && Check if the field is a string (character)which only fails on record level,which blocks only when that particular record has .null. in FI.REF
IF USED(lcCursorName) AND !EMPTY(lcCursorName) AND TYPE("lcCursorName") = "C"as testing type after accessing it with use makes no sense at all.