HPCC-10390 Fix internal error generated by <dataset> : WHEN

Signed-off-by: Gavin Halliday <gavin.halliday@lexisnexis.com>