Creating a comma separated string from array

The goal is to join values from a Woocommerce tag array into a comma separated string to publish a product on Etsy. Etsy tags doesn’t allow values that are more than 20 characters, and no punctuations or symbols in values.

Please bare with me as I’m a newbie with coding & i may be doing unnecessary and superfluos steps
Step 1 is to Iterate the array (name value) by using map & iterator module

Step 2 to create an array for the name values

Step 3 only select values that are under 20 characters

Step 4 remove Punctuations & symbols, only leave letters & numbers, using regex: /[^\p{L}\p{Nd}\p{Zs}-'™©®]/u

Step 5 clean up white spaces after commas

Step 6 to remove periods

Step 7 to finally create a listing on Etsy, with a string value that is comma separated, I’m using:


"{{join(split(98.text; ","); """,""")}}"

Screenshot 2023-12-16 at 10.13.24 PM

what i’m experiencing is that the values still have hypens and ampersands. So, i’m not even sure the Text Parser is the right tool to use or i’m just not doing it correctly.

Any help or directions would be greatly appreciated.

Thank you!

Hey @Mike_Finocchiaro,

I would try this

  1. after you iterate the tag names, you can add a filter to check the length, that way you will only aggregate the tags you are concerned with. Instead of using an array aggregator, use a text aggregator.


    Note that if you want to compare the length of the name after removing all those characters, you can do something like this:

  2. Now inside your text aggregator create your IML function to replace all characters you don’t want. You would need to use 1 replace function for each character you want to replace, here I replace with emptystring, but you can replace with the character you need (space, newline, etc…)

  3. Now inside your Etsy module, you would click the map option
    Screenshot 2023-12-18 at 3.31.32 PM
    Here you would split your output from the text aggregator by whatever you used to separate them, for example split(text;newline) if you separate by new row:
    image

6 Likes

@IOA_Harman Works like a charm! Thank you very much for your detailed explanation :fire: :fire: :fire:

1 Like