Looking through a comma separated string "list"

Options
More adventures in the bubble to xano migration!

When you export a list of users in bubble, you get a text column/field with a comma-separated list of email addresses.
[image.png]
Can I, and if so how do I loop through these emails?

I can query all users where Followers isn't empty, then create a loop for each user and within it create a loop on User.Followers? would that work? Would xano know this is a list despite technically being a single string?
[image.png]
Or was there a way during import to turn that column into a proper list?

Comments

  • Michael Udinski
    Michael Udinski Administrator

    ADMIN

    Options
    What you have there is just a single text string. Arrays will always be denoted with array brackets [] - you can see the schema structure when you click on your column name. 

    You can use the SPLIT filter to transform a text string into an array. The separator to use in this example would be the comma. 
  • Jay
    Jay Member
    Options
     I have tried this.

    I want to also trim any spaces between the emails after the commas but i get an error:

    {"message":"explode(): Argument #2 ($string) must be of type string, array given"}
    [image.png]
    If i put the Trim at the split level i get the same error but for trim:

    {"message":"trim(): Argument #1 ($string) must be of type string, array given"}
  • Michael Udinski
    Michael Udinski Administrator

    ADMIN

    Options
    This is because you now have a list. You would have to do a for each loop to apply a trim filter to each item of the array. 

    Another route might be to first use a replace filter to replace spaces with nothing, then use the split filter