* Assume your cursor with random values has an alias RandomVals LOCAL ; lnMinVal ; , lnMaxVal ; , lnIx * Get lowest and highest values: * Option 1: index RandomVals: SELECT RandomVals INDEX ON fObjectNo TAG fObjectNo GO TOP m.lnMinVal = RandomVals.fObjectNo GO BOTTOM m.lnMaxVal = RandomVals.fObjectNo * Option 2: don't want to index RandomVals: *!* CALCULATE ; *!* MIN( fObjectNo ) ; *!* , MAX( fObjectNo ) ; *!* TO ; *!* m.lnMinVal ; *!* , m.lnMaxVal ; *!* IN RandomVals * Create another cursor with all possible values, both present and missing: CREATE CURSOR AllVals ( iVal I ) * Populate the cursor with all possible values between m.lnMinVal and m.lnMaxVal FOR m.lnIx = m.lnMinVal TO m.lnMaxVal STEP 1 INSERT INTO AllVals ( iVal ) VALUES ( m.lnIx ) ENDFOR * Optional - index AllVals to help speed up the final SELECT - SQL: SELECT AllVals INDEX ON iVal TAG iVal * Get missing values: SELECT ; iVal ; FROM AllVals ; WHERE iVal NOT IN ; ( SELECT fObjectNo FROM RandomVals ) ; INTO CURSOR MissingVals ; ORDER BY iVal * Cleanup: USE IN SELECT( "AllVals" )