Renaming items without perfect match

Hello! I am fairly new to Bubble and the forum has already been a huge help. I have a new roadblock that I would appreciate any insights on.

I have a repeating group set up so that the user can change the text in a certain field and save it to the database. I’d like to go one step further and rename all similar items to the one they changed. However, the similarities aren’t consistent.

For example, the user could rename apple as “fruit”. We could then search the database for all apples and replace them with “fruit”. However, some are named “Granny Smith Apple” or “Apple Spice”.

Another example would be replacing all instances of Milkyway (written as “Milkyway 1”, “Milkyway 2” “Milkyway 3”) with “candy”.

I’m guessing Find & Replace with some form of regex could solve this - but is there a way for the user to specify the commonality (eg. ‘Apple’ or ‘Milkway’)?


Hi j111,

You might be able to do something like this…

Just before the action runs which saves the new value to the database, also put that value into a custom state, but make sure it goes in using the lowercase option. Set it up an a a text custom state, so if they type “Milkyway” your custom state will contain “milkyway”.

If you can also get your database search results to return all lowercase then you should be able to use the ‘contains’ option to rule out any case sensitivity matches (you can always take the value that the user inputted and not the custom state value when it comes to updating the data).

It sounds like you’ll be wanting to do that on a list of things though which will entail using either an API workflow to iterate through each record found, or you could use the toolbox plugin (Javascripttobubble element) to loop through items in the standard workflow.

Might have to play around with it but basically you want what the user typed in and your database search results all in lowercase before using the contains or equals operators… if that makes any sense!

Clone your app and give us access to it, I don’t mind playing with it if you like.
Hope that gives you some ideas anyway!


1 Like

Thanks! I ended up taking this feature in a different direction, but if the issue pops up again I will give your solution a try. This is still very helpful for the future, so I’ll be sure to review your solution closely. Thanks again.

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