Field value that is a combination of other fields values

Hello, bubblers.
Let’s imagine that we have a Thing called “User” with two fields: Name and Surname (both with type “Text)”.
Now I want to make a third field called “Name+Surname” (I need it for Search Box element).

Example:

Name = “Andy”
Surname = “Warhol”
Name+Surname = “Andy Warhol”

Is it possible to realise? Can’t find any operations like “+” or “join”…

Hey @artemzheg :slight_smile: To accomplish this for the search box element, I think you would need to create a new field under the User for the Name + Surname value in order for that to be the Field to Search.

Alternatively, you can have an input and a repeating group beneath which looks + functions similarly to the searchbox element. This would allow you to Do a Search for Users in the repeating group with the constraint “Any field contains Input’s value”. If a User typed in Andy or Warhol, Andy Warhol would be shown in the repeating group (along with any other dynamic data you place in the cell). If Users have a biography text field, and someone typed in ‘artist’, Andy Warhol would be displayed since that would be in his biography text field.

Hi, @fayewatson. This is exactly what I would like to do. But I can’t find any operation for this (like “+”, ""join or “concatenation”):

I would create a new field such as “Full Name” (type: text, list: no) and then the value would be:

Full Name = Input Name’s value Input Surname’s value

(Making sure there’s a space between Input Name’s value and Input Surname’s value). That should do it! :slight_smile:

2 Likes

There’s another “hack” specifically for the cases when you need to format the input, but the standard inputs fields do not give you that option.

There is a function of conditional formatting of inputs in Bubble that you can use for this purpose.
First, you need to find a condition that will always be = true.

Then you need to select "formatted as text:

And then, since the condition will always be True, you can use the proper multi-line input to concatenate values, and do much more.

Hope it helps!

Vlad.

GM at Bubblewits - Bubble Certified Partner

http://bubblestore.io – a place to buy Bubble templates for landing pages, e-commerce, workflows, APIs etc.
http://iambubble.com - one page Bubble demo
http://builtonbubble.com - Collection of apps built on Bubble

5 Likes

Oh, I use such variant to display data from several fields in one element, but I didn’t think it will work for saving data in DB. Thank you :slight_smile:

@vladlarin, thank you very much for this “bubble hack”, I’m sure I’ll use it for my apps!

3 Likes

Hi, I tried everything I could but I can’t add the space. It just disappears as soon as I start selecting the next field from the dynamic picker and in the end I don’t have any space between any of my fields. How can I do to keep the space? Thank you for your help :slight_smile:

I’ve came to this topic looking for solution to a different problem, but the answer here inspired me to get a different workaround.
I have a API call that gets several address parameters, such as street, number, complement, neighborhood, city, state and ZIP code.
What I’m trying to get is something like:

{Street} n. {Number}, {Complement} - {Neighborhood} - {City} – {State}, {Zip code}

The thing is that sometimes the record I’m getting doesn’t have one or more of these parameters, and that would leave me with unwanted spaces between each information piece. I’ve tried to use the hack suggested here, but couldn’t make it to work, so I came up with a solution using Regex.

So, for the field value I’ve just used Arbitrary text
Screen Shot 2022-05-23 at 17.37.00

And concatenated every piece of data that I need, with a :find and replace attached to it
Screen Shot 2022-05-23 at 17.37.15

Then, is just a matter of search for everything on each piece of data (thats the “(.+)” regex code, that literally gets everything and puts into a group) and replace it (thats the “$1”, that represents the first group of returned data) with the spaces, dashes, commas and everything I need to keep the formatting I need for the whole string.
Screen Shot 2022-05-23 at 17.37.25

Hope it inspires more solutions!