Error "Text filter requires a scalar value" when looping through array

Options

I want to loop through an array of teams:

["Sales",

"Management"]

For each item in the array, I want to create a new team in my Team table. However I can't seem to get to the team name when creating the teams.

When I refer only to the item in the array, I get an error "Text filter requires a scalar value".

I've already tried a different way by adding a filter 'first'. Then I don't get the error and the two teams are created however the name of the team is empty because there is no text coming from the arry item…

How can I get to the text value of each item in this simple array?

Thank you for your valuable insights!

Best Answers

  • Louis Machado - CSA
    Louis Machado - CSA Administrator

    ADMIN

    edited October 2023 Answer ✓
    Options

    Hi there,

    The variable teamItem is an object with the record with all the fields/path. What you want is only one path, which is the name. So, you just have to assign the value teamItem.name as the input name.

  • sampannemans
    sampannemans Member
    edited October 2023 Answer ✓
    Options

    Hi Louis,

    Thanks for your feedback!

    However the array is actually just a list of text strings (not objects).

    So I can't target teamItem.namebecause teamItem does not have a path "name".

    How should I approach this?

    Thanks again so much!

  • Louis Machado - CSA
    Louis Machado - CSA Administrator

    ADMIN

    edited October 2023 Answer ✓
    Options

    I see. I saw the input as an 'object' type, and I jumped to conclusions. Just modify the input from object to text and as a list, and it should work.

  • sampannemans
    sampannemans Member
    Answer ✓
    Options

    So simple, yet so brilliant!

    Thanks very much Louis!

Answers