I have implemented a view counter solutions for my contact list, so that app users could see that how many times a contact is clicked.
Solutions was implemented by creating a new property (Type “Number”), and then adding a click action update process where we add 1 (property-magic-text + 1) each time.
It is working fine if we see a single screen. But I found a bug when using multiple phones as follows,
I have two mobile phones (Phone-one, and Phone-two)
Both have opened the contact list screen.
View counter is “0” right now for my Subway (Lake City), and seen on both phones.
Now Phone-one click the Subway (Lake City), and view counter changes to 1
Click back on phone-one, then click the same Subway (Lake City) again, and view counter changes to 2.
Clcik back on phone-one again, then click the same Subway (Lake City) again, and view count changes to 3.
Now on Phone-two, clicked the Subway (Lake City), and view counter changed to 1 (from previous value of 0).
Click back on phone-two, and view counter is still 1.
At this time, re-visit the Subway (Lake City) contact at Phone-one, and the counter has changed to 1 (instead of previous value of 3), where total view counts had to be 4 till now.
This seems to be a bug, as Adalo’s update action could not take recent (or actual) updated value of view counter on phone-two to add one. Instead, phone-two added digit 1 to its own previously noted value of “0” rather than adding 1 in the recently updated value of 3 (which was updated by phone-one)
Any help from adalo community will be greatly appreciated. Thanks!!!
@k86305 hey, can you select the option “Refresh list automatically” if you’re using Adalo’s collections and try again?
Technically this is not a bug as the behaviour you observe is right because, when you load the list the data is updated at the point of loading, in your scenarios you’re having them open simultaneously and the data is not refreshed, hence the later update is overwriting your phone 1 updates.
I am able to fix my issue by using advanced list option as follows.
Just enabled this options, so that before adding digit “1”, I have most updated number already with me.
Thanks @bhanu , appreciate your reply. Actually already tried this idea and it worked.
But you are a superman , as this was really crazy issue!
@bhanu and all,
I am facing a strange issue, that my view counters reset sometimes (randomly) and I am not able to understand the mystry issue.
It used to happen before (before opening this issue), and still happening. But could not understand why counters reset to zero by them selves in random order.
Like there are counters for different contacts, and counters reset for only contacts which we are viewing but it happen randomly like sometimes after 10 views, sometimes after hunderds of views like 300+.
But all other contacts in the list which we did not touch (to view) those counters remained intact (unchanged).
Any help for this mystry issue will be greatly appreciated.
I have another solution in mind, that instead of increasing the counter by 1, I will create a new database, and just create a new empty line related to my contact, and calculate the number of lines instead of counter number. But it will put way more load on Adaloas it will have to count all lines matching a specific contact.