flatten-array using REDUCE, Filter and your extraordinary logic flat the following array [1,[2,3,null,4],[null],5 , 1 , 2] your output should a flat array with only distinct (different) values and without null [ 1, 2, 3, 4, 5 ]