HPCC-12285 Fix set index ranges

Signed-off-by: JamieNoss <james.noss@lexisnexis.com>
If you're adding an assert, you would need to assertex(folded->queryValue()), since folded will always be non-null if index is non-null.