Creating an incon with ability to create and update a record

Hi,
Tried to find the answer, but failed. Been struggling with this all day (first time building an app so bear with me) :slight_smile:
I’ve got a physical activity tracking window with a Text Input field that shows acitivity minutes added to a particular date and + and - icons (not buttons) which user presses to add/subtract 5 min increments.

I’ve set up the physical database with fields below
Screenshot 2020-09-29 at 22.17.29

In data entry window, I need the user to keep pressing + icon, which ads 5 minute increments until the required amount is shown in Text Input field (sums the minutes that are allocated to a particular day based on date selected in date picker).
The Create action is set up as this:



So far I’ve managed to enable the button to add the first 5 minutes.

I’ve added the “update” action to the same icon but it’s not working. Set up below.


As for advanced settings for update record section I’ve tried to change to different options - nothing worked.
What I am doing wrong?

I also tried to use the change visibility method for the icon, to set up one for ‘create’ and one for ‘update’ actions. But when I try to set up the ‘update’ action icon I only see ‘Logged in user’ selection (screenshot below).


Why am I not seeing the update action on the second button? I am only able to see it if the icon has create action already but that beats the purpose as I dont want to keep creating new records right?

Thanks for your help and sorry for the long read! :grin:

Tercas

Hi @tercas,

I don’t quite get the business logic here. What would you like your user to do?
Select the total amount (5 mins increments) and create the record immediately?
Or you want them to allow to update their physical activity data several times/day?
Can you please share the Data entry screen itself, and explain the flow a bit?

Thanks

Hi @Victor,

this is the screen

The user is supposed to track his physical activity and record it, by pressing the + or - signs to generate the record for the day that is selected in the date section. The user would keep pressing +/- until the desired number of minutes is seen in the data display section. There are two separate sections, one for moderate and one for intense exercise (didnt fit on the screen).

The data would automatically save without having to press anything apart from the +/- sign. The process would look like this: user gets to the screen, clicks plus / minus sign on moderate / intense activity until he gets the right number of minutes in the display, does the same for intense activity and then leaves (he should not need to press anything else). He should be able to go back to previous dates as well and do the same.

Bonus: ideally I would like the user to be able to use both, the +/- signs or enter a number of minutes in the display manually (similar to your example).

Thank you for your help! :slight_smile:

Tercas

Hi @tercas,

Thank you, I understand the idea now. Though, I see several difficulties here.

  1. When user enters this screen and selects some date, we (app) really don’t know, if the record data for this date has already been created or not.
    So for these buttons we can’t create a setting like “if activity for this date doesn’t exist, create it, and if exists - update it”.

  2. In my experiments I didn’t manage to change the value of Datepicker from the app - as I understand, it could be changed only by user him/herself. So you will need to create a custom datepicker somehow.

Apologies for late reply. I have one idea reg. 1, may be it will work. I’ll let you know later.

Hi @tercas,

After some experiments, the only thing I can suggest to solve (1) is to create a new record in the database each time users submits the activity. I.e. if user visits the “record activity” screen 3 times, and saves the minutes 3 times, there will be 3 records in the database.

And then use “Sum” + filter by date from custom datepicker to display the total amount of minutes fore the day.

With current UX requirements it is the only solution I can see… didn’t find more elegant one :frowning:

I have a similar problem. In my case, i need the button to first create and then keep updating the database entry with each subsequent press, but I only need to use the last input. Ideally, i could query the database for the last input but that’s not an option, so I am looking for a way to make each press of the button overwrite the previous data entry. Is this even possible with Adalo?

Hi @Victor,

now I apologise for responding late.

Thanks for explanation! Although not sure I understand how point 2 is related to my case (probably lack of understanding on how Adalo works on my side). I don’t need the app to change the value of Datepicker, but rather the customer select the date he wants to enter the data for.

Thanks for your suggested solution in, I think that would only work where the app would use only 1 value for a particular day (e.g. latest entered value), as otherwise UX can get too confusing to keep adding minutes for a particular day. Is Adalo able to filter out/select just one value (that was entered latest) for a particular day?

Thanks for your help!

Tercas

Hi @tercas @Simba

I have some ideas, will post them a bit later today

1 Like

Hi @tercas @Simba

Finally I did it: Adalo hints: how to create one single record for a one single date in a collection
Enjoy, and hope this helps!

2 Likes

Hi, Victor. Thanks for all the work you put into this!
Do you think it’s possible to use the same button to create the activity and then keep updating it?
A little context:
I’m trying to build a yes/no voting app. I have a list of questions and a Yes and No button associated with. each question. I need the first press of either Yes or No to create the database entry and each subsequent press of Yes or No to keep updating the same entry. My current database has three collections: Users, Questions, Votes. I need the Votes collection to only keep one up-to-date entry of each unique user-question combination, so that I could query the collection for total unique votes on each question.

Hi @Simba,

I don’t see an easy way to do it as for now.

In the case with Activities: it is possible to make the “create new record” routine a conditional one, and apply the same logic as with visibility (i.e. this action runs only if Count of Activities/Votes/Etc. with Date=selected date equals 0). Then the action will not perform if there is already existing record.
But then one needs to update an existing activity somehow, so the button should have an access for it. Usual way is to put it into the list, but then it will not be displayed if activity doesn’t exist…

From UI perspective, if you want the interface to look the same, you could make a list just out of the button, and then try to adjust layouts.

However, in your case, I don’t see the need for such logic - why would you want to create a single record for an answer for each question?

  • If you don’t need to store the info about the user who answered, you don’t really need a Votes collection: just add to counters to Questions collection (YesCounter and NoCounter), and increase them when someone presses a button.

  • If you would like to store the info about each user which answered Yes or No, then you’ll have Votes collection with one-to-many link (one question can have several votes) + one-to-many link to Users (so that one user can have several votes). This looks like what you want to achieve. But anyway you will need to create a new record for each vote.

Something like this:
QuestionID User YesCounter NoCounter
Q1 UserA 1 0
Q1 UserB 0 1
Q2 UserA 1 0
Q2 UserB 1 0

And then you can easily query / filter the Votes collection based on User or Question + counters.

Apologies for long message :slight_smile:

1 Like

Thank you, Viktor! I actually figured out a way that worked: I made the button into a list of one item, made the list of the Votes collection and this allowed me to filter it as needed. I kept the collection property as True/False.

1 Like

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.