Append suffix to integer value inside object array
![fdoolivares](https://us.v-cdn.net/6037124/uploads/userpics/K5NTGSWFM6AI/n9HC7WXT88BOH.jpg)
Hi community,
I'm currently working on this workout logger app, where frontend sends repetitions and weight values in the form of integer to Xano.
The issue I'm having is, that I would like to add a measurement unit suffix to the weight value received from the frontend. Ex.:
- Frontend send to Xano: 99.
- Xano returns to frontend: "99 kg".
For more context, I currently have this GET endpoint which contains the values of all exercises in the form of an object array…
Is there any way to update each one of the weight values per each exercise inside the object array?
Thanks for the help,
Best Answers
-
Yes you can - its a little involved because you'll need to
1) pull your keys into an array,2) iterate over your key list, (following is inside that for-each)
3) get the member at that path
4), update the sub-key with the suffix likely using to_text and then concat filters, and then
5) re-attach the member to your source object.
After this loop, your data shoudl have the suffix in place!
Not simple - but you do it once and it keeps working. Completely do-able!
-
Thanks @Ray Deck , will give it a try.
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