Error running a For loop
![ihayes](https://us.v-cdn.net/6037124/uploads/userpics/O3QL7NZMVATW/nUHNYPQREK605.jpg)
I am getting this error "message: xano\extension\xs\Arrays::xano\extension\xs\{closure}(): Argument #1 ($list) must be of type array, int given"
I am passing a list of integers to the for loop that are record ids and then looping thru each to create related records for each id. I see the [ ] brackets on the input so can't figure out what I am doing wrong.
Answers
-
Hi @ihayes - can you share some screenshots of your function stack and of the right panel of your loop? Might be something tricky being overlooked
-
-
Thank you - that's very helpful... When you run into the error and look at the Debugger, is the last function stack item the For Each Loop? And what is the value used for input: days_ids?
-
This is from the debugger. It seems to stop with the first attempt to create a record. days_ids is an array of integers.
-
Oh I see now. Your database field is an array. You don't need to loop through the list to add it, you can add an array to an array.
-
So I should create an object field on the Account (parent) table and then just add the entire array to the account? I was thinking of creating the individual records and relating them back to the Account. Have got what you are saying right?
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