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.
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.
Your reusable element’s type of content should be text:
Send multiple values to the reusable element separated by commas as a single string:
- Split the string using [^,]+ as a regex value:
- Select the specific value via item: #
- Convert values to things.
We’re using our plugin for these purposes:
- Now you can use your values: