Is there any alternative instead of using function?Yeah, sure. It won't perform as well, though, for high volumes of data. My approach would be something like below. Realistically, you'd have to pre-set some limit to the max number of values you'd allow in the list using this method. I've done 5 max values below, but I think I've designed it so that it's easy to expand it to allow more values.