@strang22 (Scott) posted a new topic, subject "Toggle/Checkbox for Binary Data in Repeating Group". It read:

   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  
    Bubble
    
    ### Bubble Editor - essandbox
    
    Build stuff without code and launch a startup without a tech-cofounder! Bubble is a visual programing language. Instead of typing code, use a visual editor to build applications.

Then @ones (Ondrej) said

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

@strang22 (Scott) replied

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

After which, @ones (Ondrej) added

    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 
    
    Have a nice day and all the best, O.

@strang22 (Scott) replied

    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!!  
    Scott
    
    Screenshot 2103569447.50.49.jpg1438×1072 188 KB

To which @strang22 (Scott) replied

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

@ones (Ondrej) replied

    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  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.

To which @system (system) replied

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


{'source': 'discourse', 'url': 'https://forum.bubble.io/t/toggle-checkbox-for-binary-data-in-repeating-group/34005', 'title': 'Toggle/Checkbox for Binary Data in Repeating Group', 'views': 692, 'has_accepted_answer': True, 'word_count': 650, 'like_count': 2, 'reply_count': 5, 'participant_count': 2, 'posts': 8, 'tags': '', 'author': '@strang22 (Scott)', 'participants': '@strang22 (Scott), @ones (Ondrej), @system (system)', 'image_url': [None], 'created_at': '2018-07-21T19:05:43.455Z', 'last_posted_at': '2018-09-29T19:05:46.943Z'}