How to make a comma seperated list Server Side

Hello my fellow Wapplers,

I have a problem?

I have a mysql database with a comma separated list in a field.

I would like to split the list to separated values and then I need to make them integers instead of strings.

I have tried millions of ways, please help.

Hi.
Due the way Wappler’s formatter is designed, split function returns strings.
You can create a custom formatter which splits and returns numeric value yourself.

You could use the split formatter to create the array of strings, then use a repeat step on that array and a set value for $value.toNumber()

Depending on how many places you need it, it could be quicker to get going that @sid suggestion but if you have an ongoing need, the custom formatter would likely be a better option

2 Likes

Hi,

Ok, thank you guys. Så there is no native Wappler way.

I think I will create a custom formatter.

I’d say this is Wappler native but it is a few steps. A custom formatter may suit you best…

Well maybe if you explain where and how do you plan to use this value, a Wappler way may be available.

Hi @Teodor
I have a form that is inserting a comma separated list in a field. My customer is using an
excel spreadsheet (I don’t know, why?? But he decides). And excel is reading from an SC file and everything is working. I want to use the split and str to numer to be able to get some data from another DB-table.