Formatting Data Outputs
How would I format my output data such that it looks like this:
[{label:'One', value:1}, {label:'Two', value:2}]
the string would column's value in a table and the integer would be a row id.
Answers
-
your string is an [] array and inside you have objects {} with just one key:value, so you can for example create an empty variable array [], and then use filter "push" , or dedicated Array operations in crud to sort of assemble your array with {objects} you get in your function steps or however are you getting that key:value pairs
-
I am unsure if I am following along. This is the data I am working with:
The value is id and the label is yearname. How would I start pushing this data into one of the options you specified?
-
if i understand you - then you can loop for through that array, and form a key:value pair from each iteration that will look like 1:"First Year", and as i said before - push each of them to new variable empty array.
hope that makes sense -
So what I did instead was create a function within my front end to take these values into an array. It seems to be working now from what I can see. Thank you for the help though!
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