>What we finally ended up doing was create another 'type' for the empty(neSigOpt) condition. What was frustrating me was that even when I changed the neSigOpt to iif(empty(neSigOpt),1,neSigOpt) as neSigOpt, we still got the same results
In VFP in case when a field alias has the same name as a field in a table, the table field takes precedence. IOW, you still referencing neSigOpt field from the table not the new calculated value. It would work if you use an alias that was not intersecting with the table filed names and adjust ORDER BY accordingly.
--sb--