Forum Academy Marketplace Showcase Pricing Features

Help with an expression to build a text field from multiple things

I need to create a dump of comments and I don’t see any reason to go to the trouble and overhead of using a repeating group. Instead I’m using a text group and just constructing a block of text out of the text from the comments.

That worked when all I tried to do was join the text of each comment with a line break. I used this:
Parent group’s actions’s comments’s body join with “line_break”

PRO TIP: you can select “join with” from the expression builder and then type “line_break” to get each piece of text on a new line.

Now I’d like to have the user’s name added before the text on each line. So something like (action’s comment’s creator’s display_name + comment’s body) + line_break

Here are the relevant things:

Thing is that “join with” takes a Bubble list and returns a single string of text concatenated with the separator.
What I want to do is follow the structure of the list of comments, joined with “line_break”, but to first concatenate the comment’s creator’s display_name onto the comment’s body. I can’t just have a text cell with that already done because the user can change their display_name whenever they want.

So far it’s easy to get a list of comment bodys, or a list of commentor names, but getting a list of name+body is escaping me.

I would suggest using a repeating group, type: comment and having the data source be that parent group’s list of comments. Then you can set the text element inside of it to be to be “Current Cell’s Comment Creator Current Cell’s Comment Body”

Ugh, I don’t wanna. Repeating groups are a pain, particularly when they’re nested inside other elements, particularly collapsing elements. There’s always some part of it that doesn’t work right because I need it to be a certain size in the editor just to build it and that carries through to the actual app when it shouldn’t.

Not sure there’s any difference really? If you have a text element, it’s going to expand unless you select cut off the content. If you have a repeating group with a text element inside the cell, set to full list, it will expand in the same way using the text element-linebreak method does. If you need the repeating group to remain a certain size then you can select fixed number of cells.

So does that mean you can’t think of a way to do it with a couple stages of text operations?

I don’t believe you can with one text element since those are two different fields.

Is there a way to concatenate two text fields other than just listing two expressions, one after the other?

I don’t know of a way to do that with a list inside of a single text element.

I’m asking if you know of a way to concatenate one text field with another. Not two list fields, two plain old boring text fields.

While investigating this I realized that I can’t find a way to combine two text strings other than listing two different expressions in the expression builder.

Seems like there should be an expression for “text + text”.

There is not an option to do that that I’m aware of. Alternatively, you can create a new text field which combines the comment creator field value you need and the comment body.

@emmanuel Is there an expression to concatenate two text strings? The only way I know of to combine two strings of text is to write two different expressions and put them next to each other in the expression builder.

There’s an expression for “number + number” is there one for “text + text”?

This topic was automatically closed after 70 days. New replies are no longer allowed.