How to use custom state if its type is a database thing or a list of things? Let’s say that we have a shop and the basket is temporarily saved in a custom state. Thanks!
are you asking how to create a custom state whose type=database Thing? Or how to leverage the data stored in that custom state? If it’s the latter, you need to provide more details about your use case so people can help.
Thanks - it’s setting the state. Setting the “elementary” state (a single text, number, for instance) is simple, by the workflow action Set state.
However, I have a group of input elements on the page and I’d like to put their values in the fields of a state which is defined for this same group. The state uses a type definition, which I also use in the database. The Set state action allows for simple mappings, for elementary states with only one value (Element -> State -> Value), not for a type. The solution would be to combine the fields into another object and to use that object in the Set state action as a value provider. But what and how …?
Check out this example. You want to create a custom state of type (db thing), and make it a list. Then use workflow to add/remove things to the list state. You don’t need to add the individual attributes (field values) to the list state, just add the thing (eg basket_item), then later you can reference the item’s price, name, quantity, etc.
If this doesn’t make sense once you review the example link above, ping back with more detail and I’ll try to help.
Thanks, dj! The option :plus item is the thing that I need.
Another question regarding the custom states based on ‘database’ types …
How to set the state to empty …?
Just leave the input field blank in the WF: Element–>Set [state_name]=
Aha - it works now.
I firstly tried it in a workflow. After setting the empty state like you proposed I had two send email actions with conditions on them linked to the state (is empty, is not empty). The actions always resolved to ‘is not empty’.
This might be a bug in bubble. I set up an example application: https://isemptyerror.bubbleapps.io/?debug_mode=true. The first button sets the status, the second button puts ‘empty’ in it, and sends email based on the condition is empty/is not empty. But I always get is not empty one, regardless the ordering of both email actions.
This topic was automatically closed after 70 days. New replies are no longer allowed.