How do I add function result to response variable as key-value pair?
Options
EricP
Member ✭
I have figured out the function stack to loop through a list of records and perform simple addition of fields within each record. The last step in the loop is "Array: Add To End" which adds the variable that is the sum of field values to the end of the loop item.
When looking at the output, it's just the value, eg. 5. How would I instead add a key to this value, eg. Total_Units: 5?
Answers
-
Hi there, nice work getting through the loops process!
You are able to use theset
filter on anobject
to create key-value pairs.You can add a new variable to your function stack and configure it like this:
The output will be:{
Total_Units
: "insert your result variable here"}
-
Thank you, that definitely leads me in the right direction.
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