Edit expressions is too difficult

I’m finding myself writing complex expressions, and then the need to add or change something in the beginning. This means I have to delete the entire expression, including complicated filters I wrote. Is there any solution to this?

For example, if I want to change a filter, by adding a restrictive clause before it, I can’t. I either add it to the end and it has poor performance (or side effects) or I redo the entire expression (and all the filters).

1 Like

Hi there, @RPSM… what you described is one of the main things the new expression composer is supposed to solve. So, you can give the new composer a shot, but fair warning, it is still pretty buggy (Bubble knows that, and they are continuing to improve it).

Best…
Mike

The new expression editor helps with this. Also, if you turn on the Expression Parentheses option (Settings, Versions) this helps sometimes.

I’m using it, but I don’t see how to insert something before other things.

1 Like

It can be tricky, but as you hover over parts of the expression, you can click on those parts to change them or you can insert something by clicking a More link that should appear after the hovered part. If you share a screenshot of what you are trying to do, we might be able to help you figure out exactly how to do it.

Of course!

I am trying to modify the “Advanced” filter by adding a check for “This User’s Account” not being empty, right after the check for the list’s search filter not being empty.

Obviously I could just recreate the filter, I’m more trying to understand how to do this for the future.

When I hover, I get the different color bars, but there is no “more” other than the one at the end. So I can add something after the condition, but not before.

There should be a ‘more’ button between every part of the expression if you click in it… that’s one of the main features of the new expression builder.

image

so just click after the part of the expression you want to insert into.

That looks cool, but I don’t get that.

This is when I hover.

This is when I click.

Aha! I got it. If you click between the expression elements, a little blue cursor appears, and clicking there the “more” appears. Perfect (but not obvious). Let me try now.

1 Like

Unfortunately as it is not possible to click before the expression, it isn’t possible to add something before it. If you try to modify the expression, it doesn’t understand that you’re shifting the expression (making the new entry a part of it rather than a precedent condition). If this makes sense…

For anyone coming to this later, this is what I wanted to end up with. I had to recreate it, as the editing kept putting the “Account” checks as part of the Search checks.

I don’t really know what advice to give, but it is very difficult to change long expressions, and so far in my short time, it is the thing I most dread on using Bubble.

(Having said that, it is amazing that with the effort I’ve put in, I have a searchable, filterable, generic user table that I can use throughout the app).

Four things, @RPSM. :slight_smile:

First, oh hell yeah to this.

That’s Bubble in a nutshell, my friend.

Second, just a heads up that ignore empty constraints doesn’t work with advanced filters.

Third, in case you haven’t come across this info yet, advanced filters happen on the client (browser) side, so there could be a performance impact, depending on how many items are returned in the search that the advanced filter is filtering.

Fourth, when you have a lengthy advanced filter, you might want to take a look at your data types to see if adding a field here or there might help you optimize things a bit. I have no idea whether or not that is the case for you (I didn’t even read your advanced filter carefully), but just something to think about.

1 Like

Point #3 made me reflect, and I’ve moved the Account check to a pre-filter (not advanced), as that would definately be better to happen on the server. I’m getting good at rewriting this filter! :grinning:

1 Like

I came up with a really terrible solution to this, but I use arbitrary text and formatted as text to get to what I want to.

You can take a group of your expressions that you want a value on, put them into arbitrary text, and then format the result of that a “yes1” for “yes”, and then for a “no”.

Then append to that artbitrary text and do the same for your next group of expressions. You can use yes2 for the next one you append, and blank for a no.

At the end, you can check to see if your appended expressions = yes1yes2yes3…etc.

The reason for numbering them is that you can now combine groups of logic. So for instance, let’s say you have two different types of logic that can produce a “yes2”. Just append them like above, and as long as “no” gives a blank respond, it’ll never be appended to the entire text string.

This was a really bad way to explain it, but I hope someone else can make sense of it.

It allows me to make complex logic with the expression editor. Now, if I ever need to change anything…it’s going to be hell.