If I understand right you just want to determine which list has to be filled up depending on the datetable result set. So, when calling the function why don’t add (help)-parameter which determines where it was called from and depending on this variable the function will know what list to use.
solved List