Getting this error; Please use a numerically indexed array
I've created a 'for each' loop to change the format of my timestamp. However, when I run it, I receive the error message 'Please use a numerically indexed array.'
Does anyone know what I'm doing wrong?
Here you can see what is happening:
Best Answer
-
That discussion has been resolved here:
Answers
-
You are using get record for expeditions, it returns one object not an array, So probably the first loop is a proble here.
-
Thanks! Do you know what I need to change in the first loop to solve the problem?
-
Hello,
Instead of using a "get record" request you should use a "query all records" function.With the "get record expedition", you'll get only one expedition inside the variable, with the "query all records", you'll get an array of expeditions.
The loop needs an array to iterate.
-
Thank you! I'm already using a 'query all records' request, but for my application to function properly, I also need a 'get record' request to retrieve a specific expedition.
My goal is to convert the 'date' timestamp, which is in an add-on, to a more readable format. Is it possible to achieve this with my current 'get records' setup?
-
"My goal is to convert the 'date' timestamp, which is in an add-on, to a more readable format. Is it possible to achieve this with my current 'get records' setup?"
Xano has a filter to convert timestamp to a more readable format:
I don't know if there is a way to format that data "on the fly" within the addon inside the "get record setup".
But depending on your datas volumetry and possible performance issue of doing it like that, you should have probably originally store that data in another column of your table with the correct format? So that you can have it directly in your addon without any transformation while retrieved.
i hope that it can helps -
In terms of first loop, just delete it and in second loop use expeditions.sessions.id. And I don;t think you need the last loop either. Your sessions addon is as "self". The best way to build is to run&debug your function stack on every step of the way to see what you are getting after this step and if this is what you need.
Regarding changing the date format. If that is just a display thing for the users, then it might be best to just adjust the format on the front-end side.
-
The subject has been closed here:
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