Counting sepcific Charachter in String

Hello All,

I am pulling a sting of data separated by “,” using pull data from our own database, and I want to separate them after being pulled, and get one attribute based on the separated number from data base, I am am using a repeat to do so, however there are some errors:
1-it is path dependent) if I press previous it would not work.
2-It would not work with a large string
I would appreciate if you would give me access so I would upload the file.

Can you help me solving the problem

Welcome to the community, @Hassannasiri! You should now be able to upload your XLSForm in the forum.

Thanks attached you can see the isolated case I have been talking about
Test Pulldata.xlsx (20.2 KB)