Any way to remove Duplicates in text?

I entered a bunch of products on my site through parabola I’m estimating that roughly 1000 of them duplicated the SKU for a bad workflow design on my part in parabola. Is there any way to fix this on Bubble’s side?

Example
So instead of Sku ABC1 It’s SKU ABC1ABC1

Hi there, @mack2580… if I understand your post correctly, you should be able to truncate the value to get rid of the duplicated SKU. So, in your example, ABC1ABC1 truncated to 4 would do the trick. I’m thinking you could run a workflow to make changes to a list of products, and the list would be defined by searching for products where the SKU is greater than the number of characters in a non-duplicated SKU. Then, make a change to truncate those SKUs, and you should be good to go.

Does that sound like something that could work for you?

Hope this helps.

Best…
Mike

That would work my only issue that I forgot to mention is the character length for the SKU’s are all different lengths some have 4 others have 12

So the duplicated ones that normally have 4 have 8 and the ones that have 12 have 24? If that is the case, you could still do what I described, but run two workflows, and define the lists by counting the number of characters in the SKU (i.e., find the SKUs with 8 characters and truncate them to 4 and find the SKUs with 24 characters and truncate them to 12).

1 Like

Are all the sku on a form like SKU codecodewhere the code is repeated twice and there is a space before the code?
You can try find and replace with regex expression enabled. Find (\s)(.{4,})\2$ and replace it with $1$2. This will change SKU asdfasdf into SKU asdf, and is also safe to run on non repeated codes because will only match a double text of minimum 4 characters (eg. SKU asdf will not match, so nothing will be replaced).

1 Like

This topic was automatically closed after 70 days. New replies are no longer allowed.