Toggle/Checkbox for Binary Data in Repeating Group

I have a data type, event, with several binary (y/n) features attached to it.
I display this datatype in a repeating group with ionic toggles filtering the results.

My desire is that when a feature toggle is off, that the repeating group display all results (Y & N) and when the toggle is on that it only display Y values for that given feature.

Right now, when the toggle is off, it ONLY displays N values.

Has anyone solved this or a similar issue? Should I be using states to solve?

Here’s a simple editor example

Hi strang22, cannot access your example. Can you check why it isn’t showing? Regards, O.

Woops, had it on private. You should be able to view now. Cheers.

Hi strang22,

it took some time, but I figured it out. You had a logical statement of type s1 = s2, which evaluates to true in two cases, namely when (s1 = true / s2 = true) and also when (s1 = false / s2 = false). You don’t need that. Instead you better add custom states to your repeating group, which are lists of logical values, and search for items by finding their state in the list.

For instance now you have a list 1 attached to your repeating group. If the ionic toggle 1 is off, then list 1 contains both logical values {true, false}. But when ionic toggle 1 is on, then the list 1 contains only the single logical value {true}. By searching for feature 1’s state being contained in list 1, you get to the desired result. Do this for all 3 features and their corresponding lists and you are good.

Concerning the implementation, there are 4 workflows to be implemented. The first one is executed at page load and pre-configures the 3 lists. The other 3 workflows are triggered when the respective ionic toggle is manipulated.

So here you are, hope this helped :grinning:

Have a nice day and all the best, O.

1 Like

Hey O,

Thanks a ton for this! It works exactly as envisioned. I’m having a bit of an issue parsing out what’s going on, admittedly my understanding of states isn’t what it should be.

I think understand what you’re doing with the three toggle workflows. They edit the custom state list which causes the repeating group’s datasource (and resulting display) to change.

I’m struggling with understanding two things:
What are the custom states On and Off that are attached to the repeating group but aren’t lists?
And how do these two states interface with the actual data in the database?

Really appreciate your help!!

I’m still unsure how this works, but I’ve been able to recreate on my main app. Thanks O!


Hi strang22,

  1. the custom states on and off attached to the repeating group are merely bins holding the values true and false, kind of a cupboard containing the ingredients before you go cooking the logical statements :grinning: I called the states on and off instead of true and false because it appears to be the proper terminology of the ionic toggle.

  2. and cooking you go in the workflows, there you find statements like “RepeatingGroup event’s list 1:plus item RepeatingGroup event’s on”. This adds the value true to the list 1 after it was taken out of the cupboard on. There are tons of ways how to do one and the same thing in bubble, for instance you could also attach the states on and off to the ionic toggle, but this would either break their symmetry, or triple the implementation effort.

Your welcome, and thanks for the like !

Regards, O. :paw_prints:

1 Like

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