Does anyone know how you’d go about keeping messages from the same user in the same repeating group cell?
This would be in a chat group, if a user sends multiple messages. See below, how would I go about keeping the name, avatar, and extra information just for the first message?
@Nocodify Are you trying to have the repeating group cell say the User’s information only in the first Message cell? And then no information after that? So it would look like:
Jay Glase in Online Pay 15 minutes ago
“fef”
“wfe”
@Nocodify One option may be to put a transparent input into the repeating group cell. The initial content of that input would be “Current cell’s Index - 1” (to give us the previous cell index # of each repeating group cell).
Then, add this conditional statement to the elements you don’t want to show at all times (the name, avatar, extra information):
“When Repeating Group Messages: item# (Transparent Input’s Value)'s Creator is Current Cell’s Message’s Creator” --> This element is not visible.
This is telling Bubble, “if the Message before this Message was created by the same User, don’t show their information again”.
This way, the User information would only become visible if the previous Message was not sent by the same User. I haven’t tested but I think that might work
Ah, sorry about that! I just tried and couldn’t get the composer to accept “When Repeating Group Message’s List of Messages, item # (Transparent Input)'s value’s Creator is not Current Cell’s Message Creator” as well.
A different way would be to save this information in the database (this may not be ideal, if any other Bubblers have a different suggestion I’d be interested in hearing it as well!)
With the database approach, you could add a field to the Message type which is “Show User Info” (type: yes/no, list: no). Then, as new Messages are created, you would set that Message’s “Show User Info” field to “yes” when:
“Repeating Group Messages List of Messages: last item’s Creator is not Current User”
And set it to “no” when:
“Repeating Group Messages List of Messages: last item’s Creator is Current User”.
Note: The expression when you Create a New Message would just be: Fields to Change
Show User Info = “Repeating Group Messages List of Messages: last item’s Creator is not Current User”. Then the value will be “yes” or “no” depending on if the expression is true or not for the new Message.
Once that’s set up, you can add two conditions to the User information elements in the repeating group cell:
"When Current Cell’s Message’s “Show User Info” is “yes” --> This element is visible.
"When Current Cell’s Message’s “Show User Info” is “no” --> This element is not visible.
*This would only affect New Messages created after you set up the fields and workflows.
One potential issue with this approach is if you allow Users to delete Messages. For example, if a User sent three Messages, and the first Message was deleted (which had the “Show User Info” field set to “yes”), then the second Message’s “Show User Info” field would need to be changed from “no” to “yes” in the delete workflow, to ensure the User’s info is shown for the new ‘first’ Message.
@Nocodify It looks like the group which contains the Message only is in its own repeating group? I’d double-check to make sure it’s only within a group element
Correct, I think it’s a workflow thing. Because when hitting enter for the second message, it’ll create a new message in the workflow, and give it it’s own repeating cell.
Each Message will be in a cell no matter what, so a repeating group within the repeating group is not needed, and that is causing it to look like there’s a duplicate. If you use the same setup as the example (two regular groups within the cell, with conditional statements on each), it will work as expected
Ohh, no worries! Can you share a link to the app editor (Temporarily set to public by going to Settings --> General --> Application Rights --> Everyone Can View or Edit? Or some screenshots of your setup and the workflows?