Join Array with a new line?
Options
Hey there!
I'm trying to build .ics files inside Xano from scratch and what I'm doing is depending on inputs, conditionally adding variables to an array. One might be if it's virtual, there's a location, etc.
At the end though, when it's time to build the file,l I need to take all the "lines" or values of the array and create one large variable with all it's contents, however, there needs to be a new line between each variable.
Is this possible?
I'm trying to build .ics files inside Xano from scratch and what I'm doing is depending on inputs, conditionally adding variables to an array. One might be if it's virtual, there's a location, etc.
At the end though, when it's time to build the file,l I need to take all the "lines" or values of the array and create one large variable with all it's contents, however, there needs to be a new line between each variable.
Is this possible?
Comments
-
Here's a screenshot that shows how you accomplish it. You get your lines into an array of strings. Then you use the join function to connect them. Since Xano doesn't handle unescaping, you connect with the escaped newline character (e.g. backslash-n). You apply a nested filter with json_decode to unescape it into an actual newline character. Voila - newline-delimited text. It'll look wrong on the run-and-debug output, but if you copy and paste into notepad or the like, you can confirm the correctness of the result.
[image.png] -
Wow thanks, I'll give this a shot!! I was trying join with \n but I'll try the json decode 🙂 Thanks!
-
Ahh dang this doesn't work
Exception: Error parsing JSON: Syntax error \n -
Update: I missed the requirements for quotes, now this seems to work! Thanks I'll do some digging and text further to make it work. Appreciate it!
Categories
- All Categories
- 53 ? Announcements
- 47 ? Releases
- 37 ? Welcome
- 983 ? Help! I'm a Noob
- 125 ? No-Code Front-Ends
- 633 ? Working with APIs
- 439 ? Transforming data
- 126 ? Connect Xano to ...
- 50 ?? Find an Expert
- 348 ❓Other questions
- 35 ? Security
- 22 ✂️ Snippets
- 19 ? Showcase
- 7 ?️ Xano Chatter
- 62 ? Video Tutorials
- 171 ? Request a feature
- 229 ? Report a Bug
- 19 ? Templates & Extensions
- 7 ? Feedback