Need help with saving user's variable states with ioniccheckbox

Hello! I am new to bubble, been trying it out for about 2 weeks on and off and now I am really stuck.

The general idea is that users sign in and there is a checklist of three things they need to complete a day. I want them to click the Ionic checkbox of the task they completed and then submit to save. In the background Bubble is keeping track of which tasks they completed and how many they completed.

What I have I currently is a User with the types of task1_state, task2_state, and task3_states to track the three tasks. The task1_state type contains current user, task1_num (0 or 1 for counting how many tasks completed), task1_status (yes/no for status of the checkbox being checked or not), and then task_complete (yes /no , long term state if user completed said task).


Right now with how I’ve set thigs up, the user’s task1_state’s fields are not updating the with ionic check box.

For example, I want user to check Ionicbox A which represents task 1. This will mean task1_state is yes because box is checked. When user clicks submit, I then want that user’s task1_complete to be yes and task1_num to be equal to 1 so it can be counted. This is how I have it currently set up. Checking and unchecking the ionicbox seems to not be doing anything. I have the ioniccheckbox to make changes to Current User’s T1’s task1_status = “yes” when checked and another condition for when inoniccheckbox is unchecked to make Current User’s T1’s task1_status = “no”.

I know I didn’t set up my database to be flexible with the number of tasks since I know there is always just three tasks to keep track of. Not sure why this isn’t working

Hello Alina @mech_alina

I cannot see what the fields are for task states 2 & 3, but I am going to guess that they are the same as task state 1.

Unless there is a compelling reason to create a database structure with so many different things that inform about progress and status … I wonder if your app can benefit from an alternate database structure.

If you agree with the above, I suggest you consider the following:

Have only one thing called “task”. With the following fields:

Name: type text
Number: type number
Complete: type y/n
User: type user
To-Do List: type to-do list

I did not include a status y/n field because by the mere fact that the “complete” field be yes or no, it would mean that its status is yes or no respectively.

When a task is created … the flow can:

  • name it
  • assign it a number (+1 everytime it is created … this can vary depending on how/when it is created)
  • set complete to no (not necessary if you set “no” to be the default setting for this field in the database)
  • assign the current user as the user … or assign a user from a list of users to the user field
  • assign the respective to-do list where the tasks will be created under to the to-do list field of this task

So … when task 1, task 2, task 3 are selected one by one in the RG that displays them you can set it to update each of them with a recursive flow upon clicking on submitt. Or avoid using a submitt button and just enable autobinding directly to the “complete” y/n field. This means that when the user changes the ionic checkbox to yes or to no … the complete y/n field is updated directly without a flow.

image

Hope the above makes sense.

Also, you can watch the following tutorials … which do not cover everything I mentioned above … but some of it. They should spark some ideas on how to do the above the best way possible and also what to look further for in the form of learning.

Autobinding | Bubble.io Tutorial
Create and save list selections | Bubble.io Tutorial

Best of luck with your app! :+1:

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