I am having trouble with a page that contains multiple ‘panes’ (basically squares) labelled A1, A2, A3, etc. These panes can have an arrow inside, pointing Up, Down, Left, or Right.
The panes (A1, A2, A3, etc) are stored as an option set called
OS_window_panes and the direction of the arrow is stored using an attribute called ‘Direction’.
The goal is for a user to click on a pane, have that pane saved as a custom state ‘selectedPane’ and then choose an arrow direction - if the user clicks on the “Up” arrow, for example, I want to set the ‘Direction’ attribute of the
OS_window_panes to be “Up”.
Currently, clicking a pane successfully stores the selectedPane in the custom state. Then, once that is saved the user clicks on an arrow … I am doing this in the workflow to try and set the arrow direction, but I can’t seem to make changes to the
OS_window_panesdata via a custom state.
Option Sets allow you to have a static list of choices
The key word here is “static”. You set them in advance in the editor and then they are read only in the app
My options are static in that they are a set list. What I am trying to do it change a custom state’s value based on the option set of another custom state. I was initially surprised that this was proving difficult but now I think it is slightly complex.
Apologies for my previous reply, there were several spelling mistakes which I’ve corrected (it was not clear)!
what type of data is your custom state?
My understanding from the first post is that it’s of type
OS_window_panes that you say it’s an option set. Therefore the custom state can only be assigned the value of an option set, but you can’t modify its attributes.
In your picture it looks like you are trying to set the value of
selectedPane that I suppose is of type
If you want to change a custom state based on a condition just put the condition in the “only when” section
I just make a quick video which may make things clearer on my aim Loom | Free Screen & Video Recording Software | Loom
correction, I meant to say that my workflow’s custom state needs to refer to the option set to choose the pane.
Unfortunately I detest video explainations of issues that are not a visual/graphical problem.
Sometimes it’s better to explain this kind of issues with written text and some screenshots of the actual implementation because it helps framing the problem and reasoning about it.
So, are you having a difficult time setting up the custom state (called
selectedPane) as in your first screenshot?
If yes, what type of data is it?
Do you need to set
selectedPane based on a condition?
Something like: if
up then set
pane1 else set
If yes you just need 2 “set state” actions, each one with the cossesponding value, and the corresponding condition to run, so that only one will run because of the conditions.
Ok I understand. Unfortunately I can’t stay online much longer tonight but tomorrow or Tuesday I will produce a clear visual which may help. Appreciate your help thus far, I know a lot of the issue is my inability to explain things clearly sometimes!
Most of the time you will find the solution yourself once you can explain it clearly, take your time
I have the good folk at pronocoders helping with this and I am still trying to fix it but here’s a simple outline of the issue;
have two option sets:
optionset-1 has an attribute which refers to
The page has a custom state
selectedWindow which references
So, you would think I could search
optionset-2 but I can’t.
My conclusion is that a custom state cannot reference an attribute of an option set.
I tried this setup and it’s working:
create option set
create option set
set1 with a field
set2ref of type
create an option
option2 of type
create an option
option1 of type
set1 with the attribute
set2ref pointing to
create a custom state of type
set1 with default value
add a text that display
custom state > set2ref > display
correctly display the text
option2 in the preview
As you can see you can access nested attributes of a custom state that has an option set type. If you can’t it’s because in the expression you are building it’s not an allowed value
As I said before I suspect that you are trying to modify an attribute of your custom state, but because your custom state is an option set you can’t modify its attribute, and that’s why you can’t access what you want in the formula.
Thank you so much that’s very kind of you to set that up. Hmmm, now I am very confused because it seems to work for you.
Here’s my actual set up;
I have an option set for window panes (A1, A2, A3 etc) which references open Direction.
The Direction option set looks like this has it’s own attribute with some SVG code.
I have a custom state on the page which references the window panes;
My page is a reusable group called “r-WINDOW-creator” so I can’t see why this code doesn’t work, especially because it is blue and no error;
OK, I have started over;
User clicks window A1 which sets the page’s custom state to A1
User clicks the button which should show the ‘arrow up’ on that window
Now, in the workflow I need to set the page’s “OS_Direction” to ‘Down’, but then how does it know to refer to A1?
To approach this differently, I need to set the state of the custom state “selectedPane”'s window. But, as previously mentioned, Bubble is only giving access to the panes within that custom state’s option set and not the attribute (direction). Ideally I want the Value below to be ‘Direction is Down’.
@dorilama After working through this with the pronocoders team it appears the only way I can do it is by changing my set up to include data in the database (as admin data) which can be referred to.
I won’t describe the issue any further because it is so complicated I can’t explain in a way which makes sense to me, let alone you! My window configuration is perhaps more complex than it appears and maybe there’s a conflict issue which prevent me from using your provided solution.
I have a solution provided by pronocoders which I am going to try and understand and implement. Amazing how something I thought would be simple has become a pain! Thank you for your help anyway …
I’m glad yoi found a solution.