Advanced Bubble users, what's a neat trick you recently discovered?

In the example here, the yellow square use a boolean to show the content of the input element if not empty or to display a static message saying “No comment here!”

As @sudsy posted (see above), the blue square demonstrates an example of using custom states. In workflows, when you set the value of a custom state, you can’t combine multiple values in the expression builder. But using boolean:formatted as text, you can.

Cool stuff. Am I correct that the filtering is done client-side, meaning that this approach would not improve data load time for large data sets?

(Note: This is a theory that I have not used yet, just kind of a fun idea)
(Note 2: Yes, step 3 would kill load time for larger data sets. If I used this, it would likely only ever be for relatively small datasets.)

Combining 2 data types in a single RG:

Let’s say you want to combine 2 data types in a single RG search result. For this example, we’ll be combining “Coffee Blend” & “Soda” data types and we’ll be sorting the results by caffeine content.

Step 1. Create a repeating group of Coffee Blends and sort by caffeine content (descending). We’ll call it “repeatinggroup coffee”. This will eventually be the combined repeating group with both data types.

Step 2. In a hidden element (I usually put things like this in a popup and just refer to them as needed) Create a repeating group of Sodas. We’ll call it “repeatinggroup hidden soda”.

Step 3. WITHIN the first cell of “repeatinggroup coffee”, underneath the content you’ve created to describe the Coffee, create a repeating group with the type “Soda”. Set the data source of this RG to the following:

  • Repeatinggroup hidden soda’s list of Soda’s: Filtered
    • Caffeine content <= current cell’s Coffee Blend’s Caffeine content
    • Caffeine content > repeatinggroup coffee’s list of Coffee Blends: Item number [current cell’s index + 1]'s Caffeine content.
    • Sorted by Caffeine content -> Descending

The result should be a combined list of coffee and soda, sorted by their caffeine content in descending order.

Anyway, happy Bubbling!

5 Likes

Yup, client side.
The full list should be loaded into a hidden list of things and the RG in the focus group should have it as its source to filter.

Just curious why a UI element would be used when it’s never actually going to be shown. Couldn’t a custom state be used for this?

1 Like

Yep, you’re 100% correct, @sudsy. There are 2 reasons that folks don’t use a custom state:

  1. They don’t know about custom states.
  2. They might be feeling lazy and don’t want to create a workflow to populate the state

… but it’s silly to use a repeating group simply to hold a reference to some list when you don’t intend to visualize anything.

Another alternative to using a custom state is to use my awesome List Shifter plugin, which one can think of as a repeating group with no visible component or a custom state will a bunch of extra utility functions on it. Since it has a field for the source list, you don’t have to execute a workflow action to populate its list. It just happens automagically on page load, just like a “hidden” repeating group. (Also, iteration.)

Aside: It kind of doesn’t matter as @nnich19’s example will not actually work. Because:

repeatinggroup coffee’s list of Coffee Blends: Item number [current cell’s index + 1]'s Caffeine content

… is not an expression that you can build (because no parens).

6 Likes

That sounds pretty cool and useful. I’ll have to check it out. :slightly_smiling_face:

Or 3, they read from one of the hardcore bubblers that an RG is slightly faster than a custom state :grinning: I would be very happy if that’s not the case as I much prefer custom states. They feel more organized than an invisible element.

The way I understand it is that a hidden repeating group doesn’t actually populate until another element calls on its data. Does the List Shifter actually populate on page load or does it render the same as the hidden RG?

1 Like

And 4., the RG list is automatically refreshed when you do changes on the DB.

For example, if you have a list of 4 items in a RG and in a custom state from your DB and you delete one item:

the RG will show :count 3
the custom state will show :count 4 with an empty row

So the question is more like why would you use a custom state instead of a RG and make your life more complicated than it should be.

8 Likes

Combine small data types into a new data type.

Why did I need it?
I have an application where my users store their data. However, they may cancel their subscription one day and will want to export their data.

Problem: These data types were divided into small pieces for performance, of course the user thinks of them as a single data type.

In order for this data to mean something to the user, I tried to combine the data into a new data type using Schedule API Workflow on a List. As the list grew, things became harder and I needed to increase the capacity of 2 units for 400 lines.

Instead, after creating (A or B …) data, schedule the API workflow to create one (E) data.

Adding related data individually results, in faster than converting data at once and protects against cost increases

1 Like

Using the expression Current cell's index can be very handy at times on repeating groups. The problem is, when a group is then added into a cell of a repeating group, it appears the Current cell's indexexpression disappears from the list, not being available to select.

While this is true, its not available in the list, you can still copy the dynamic expression and paste in where needed e.g. content, conditions, workflows…

Here is a hacky workaround, that appears to be working fine as it stands of this post date:


Current cell's index doesn’t appear in the list - this text element is inside 2 parent groups

Here we copy the working expression of Current cell's index inside the root of the rg
image
Then, we can paste the expression into a element
image
Dynamically this expression appears fine and doesn’t flag as an app error
image
Can be used on a condition example
image
Result of the above rendered
image
Example of workflow use

7 Likes

That’s interesting. That actually seems like a bug.

2 Likes

There is the same issue when you need to know the state of an element (visible/pressed/hovered…) within a workflow.

You can’t, say, animate an element only when another element is pressed directly. Instead you have to build the expression in the Condition tab of the property editor and copy/paste it into your workflow.

4 Likes

Yeah nice point about the states that are usually locked to the ‘Conditions’ tab on the elements.

Having built in access on the workflows for those mentioned, visible/pressed/hovered would make life alot easier and clearer. For instance ‘When this button is hovered, show this alert’. They seem pretty reliable when these dynamic expressions are copied in. It would seem possible through the platform these are accepted and working, so not sure why there is no direct integration? Hopefully in the works with the new UI/UX design :crossed_fingers:

I raised a bug few weeks ago on that matter. I was told it was indeed a bug:

I was about to post here, but finally decided to make a new thread.

I have developed a way to create buttons that require 2 clicks to launch an action. They are useful when a confirmation is needed but a popup is a little too much for the task.

They are pretty simple and straightforward.

1 Like

Hey Julian…

Thanks for creating such a cool post!

Here are a few thoughts from my side…

  1. Current Date/Time isn’t empty :formatted as text
    I use lots of States, but they can be quite limited in how you can make assignments to them, so I find myself constantly using the “Current Date/Time isn’t empty :formatted as text” trick mentioned earlier to make complex text assignments to them.

  2. Text Encoding
    After building a complex booking form, I’m becoming a big fan of what I loosely called “Text Encoding”, where you can pass a two dimensional array of information around as a list of text. So I define a one dimensional format for the encoded text, such as:
    value1¦value2¦value3¦value4
    Then having a list of these creates the the second dimension.
    To work with this requires some confidence with regex which took me a while to build up, but now I am flying and it enables information to be captured really rapidly in a form using States, and then processed into various data Things later on by an api running in the background if required.

  3. Reusable Element Trigger Pulsing
    So you have a reusable element (RE), and you want a workflow in that element to trigger an action on the page where the RE is used. For this I define a boolean state on the RE called “Trigger XYZ”, and I set it from No to Yes for just 500ms when the trigger is to occur. On the page where the RE is used, I have an event which triggers when the RE’s “Trigger XYZ” is yes. Works a treat and has enabled me to keep my design structure clean with REs at times when I thought that wasn’t going to be possible.

All the best,
Antony.

7 Likes

Love this tip!

1 Like

custom states of list of things that you set during page load don’t really work for large data sets…I have a list of 1700 items and it doesn’t ever work to get it to on page load set a custom state for the list…instead using a repeating group placed in a popup works fine

Interesting. A couple things though…

  • What happens (or doesn’t happen) when you attempt to load a large data set into a state? Is there an error, or does it silently fail with no items loaded at all? Or do less than 1700 items get loaded?

  • Do 1700 items actually need to be loaded, or might there be a way to further constrain the results?

  • Unless the”full list” option is used for the RG, Bubble is intelligently restricting the number of items retrieved, so all 1700 items are not actually being added to the RG at once without that option.