or using the .toString() on the bind that outputs ["Mon","Tue","Wed","Thu","Fri"]
It works with a query but I don’t currently have a JSON field to test that
Below is a output from a standard query and t is the set value with the flatten formatter and the to string maybe this helps if the same works for JSON fields?
@tbvgl Aah, got you now. I’ve done that and it’s now showing the new formatters (nice work, I’ve not dabbled with custom extensions yet) but I’ve realised this is for NodeJS whereas this project is PHP.
I was hoping I could do the conversion on the client site (App Connect) but have now done it server-side (Server Connect) like this:
Ah, so it is not actually JSON, just text stored in a JSON field.
Probably need to go down the replace() as you specified or alternatively split() on “,” to create array then you could rebuild in a repeat or actually output in app connect in a repeat
Have you tried doing it server side using the array list feature?
We do this for comma separated columns to create lists of options related to reservations extras in our case.
Really simple and saves all that client side formatting.
In Server Connect we create our query which contains the comma separated values. Then we create a list with the Array component. We call this list in this example. And we pick our column from our initial query and split it.
Am sure with a couple of tweaks on the above you could achieve what you are after @sitestreet.
Just throwing it out there.
This stemmed from an issue we had asked for help with:
But the response to our question did not work so we sought an alternative route. Which is when we turned to using the Array features within Server Connect. We then figured it out, and have used this dozens of times now as we store more and more data in a comma separated format.
The Array side of Server Connect is so useful!! Really worth investigating. Like I said keep all that formatting server side and away from the client. Speeds up response especially if you are formatting lots of output to the browser side!
Man that sounds long-winded, but it really is not. A few minutes, and as I said maybe a slight adjustment to suit your requirements. Play around with it, am sure you’ll get there following this approach.
Thanks @Cheese. That’s a really good resource you’ve created. I’ve used the new array feature quite a few times, it’s a superb addition to Server Connect which has made things so much easier. I now realise the key is to do the formatting server-side rather than client-side which was what I had stuck in my thinking.
Really speeds up the whole user experience and is far easier to manage. Personally I hate scruffy code on the client side and would rather hide it away on the back-end. Just output exactly what I want in the way I want it. I’ve no idea if what I suggest above will help with your situation but am sure with some tweaking it will achieve what you are after.