Error running a For loop

Options

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

  • Michael Udinski
    Michael Udinski Administrator

    ADMIN

    Options

    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

  • ihayes
    ihayes Member
    Options
  • Michael Udinski
    Michael Udinski Administrator

    ADMIN

    Options

    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?

  • ihayes
    ihayes Member
    Options

    This is from the debugger. It seems to stop with the first attempt to create a record. days_ids is an array of integers.


  • Michael Udinski
    Michael Udinski Administrator

    ADMIN

    Options

    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.

  • ihayes
    ihayes Member
    Options

    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?