Send multiple values into reusable elements not using states

Hello,

I want to share with a tip which we frequently are using.

Reusable element is an excellent feature for avoiding duplicate items, workflows, and other stuff.

If you aren’t familiar with reusable element feature yet, you can read the following useful topic created by @petter:

There are cases when you need to send more than one value into a reusable element.
You can use a standard solution to achieve that. So, you need to create states for the reusable component and assign values via the workflow section.
The cons of that solution are:

  • It works with a delay because you need to wait while your workflow won’t update the states;
  • It’s hard to update the states in the case if you are using your reusable component inside of a repeating group.

The idea is to send multiple values separated by commas as a single string. Then, split the line using the Bubble regex built-in feature.

Scenario:

You have a page that displays listings and their expiration in seconds. You need to deduct the current date/time with a listing’s expiration date. Therefore, you need to update the current date/time via the workflow section each second.
The right way is to update the current time on the page where you are using that reusable element only to avoid multiple triggering in the reusable component. For instance, the page displays 30 listings. In that case, the system generates 30 reusable items. Therefore, the system will trigger 30 events each second for updating the current time inside of the reusable items.
It doesn’t sound right, so, you need to update the current time on the page only. Then, send the value to the reusable items.

Instructions:

  1. Your reusable element’s type of content should be text:

  2. Send multiple values to the reusable element separated by commas as a single string:

  1. Split the string using [^,]+ as a regex value:

  1. Select the specific value via item: #

  1. Convert values to things.

We’re using our plugin for these purposes:

  1. Now you can use your values:

Editor:

Preview:

17 Likes

thank you for the great idea. the split text method works like a charm!

2 Likes

Hello, how does 'String to Thing" work behind the curtains? Is it efficient?

How is it different than performing a search using the constraint that the Unique ID is the regex extracted text?

1 Like

Hi!

It doesn’t provide any performance updates since it’s similar to the Search for Things. So, when you pass a unique id to that plugin, the Bubble app makes its native search stuff: