Is there a better way?

Hi there,

I am trying to implement a workflow where it displays a list of temporary conditional messages. For example, when the user completes a form and clicks save, a list of comments appears via a repeating group when certain conditions are true, so the list can have no comments or a list of comments.

I’ve done this by having a datatype call comments which is a list of text. Every time the user click saves I have the workflow delete the list (so that there’s no repeat of the same comment) then re-adding to the list if a condition is true for each comment assigned to a particular condition.

This work as I want it but it seems inefficient and slow the page down because of the deleting and re-adding to the database. Is there a better way to implement this without writing and deleting the database? I can’t seem to get this done with a custom state.

Any tips to implement this without writing to the database?

thanks

I am a bit confused about what you are attempting in terms of use case.

  1. What are the conditional messages for? If they are to show that the form was completed there are “alerts” for that. Bubble has built in alerts you can use ( in workflows trigger alert ) but there are also some nicer looking plugins with alerts ( I think air alert ) is the name of one. Have a look through the plugins search for “alerts”.
  1. What kind of conditions are you setting on the repeating group? If these conditions are based on the form being completed or not, then you should set your inputs to “this input should not be empty”

Screen Shot 2020-01-03 at 12.56.41 PM

That way any inputs not filled in will automatically be highlighted as necessary and the user is directed to this without the need of a workflow.

  1. If your comments are static ( because they are saved in the database and created by you ) and your conditions to be met are also static ( again created by you ) then just add a data field to your data type that would be the condition for which to show the comment or not. Then you don’t need to delete the list.

Provide a bit more details of what your use case is, what the comments say and what are the conditions which need to be met for comments to appear.

Thanks for your response.

What I am trying to do is implement a “feedback” system when the user completes a form. It’s not validation, but rather some feedback about the input or results of calculations. for example, if a value is less than 1.5 then add message " The value of x is considered low" to a list. The input is still a valid input. I want to show this message at the end with a repeating group when the save button is pressed, so it’s a list of feedback messages that shows if certain conditions are met (like x <1.5 or Y+w>10 etc). The conditions are static and corresponding messages are static.

My current work flow is: User click save -> validate each static conditions, if true add corresponding message to data type (list of text) - show list with repeating group -> delete list when user takes next action.

I think this part

is unnecessary and you already pointed out correctly this is the “bottleneck” and would be better to use an alternative approach.

Firstly to show a message based on the results of a calculation of some kind you could set up conditionals on a text element to change the text based on conditions such as

on the text element, and most elements, there is the conditional section of the editor where you would do this. So if you have all the certain conditions that would need to be met and the corresponding messages you can do that.

If you need it to be in a repeating group, and have the results displayed in a repeating group, you could just add the text element into the cell with the results and set the condition to refer to the current cell’s results and have the text changing that way.

If you want to have two separate repeating groups you could set up conditional formatting with two conditions that need to be met. The first is like the previous but the second would use the cell’s index to refer to the results in the other repeating group.

For example R.G. 1 contains results; R.G. 2 simply has a text element.

R.G. 2 conditionals on text element change would look like : when current cells index is R.G.1 cells index

Also, you may want to look into the new feature of option sets, I have not, but it seems to me like this could also be a use case for them.

Thank you,

You gave me some good ideas to explore.