Auto updating list when another user adds entry

Hi folks, thanks for all the continued support.

I am making an app where multiple users can increase a number in a field.

On my home page, I display a list that has a progress bar that shows that number.

I have enabled “auto update” on that list in advanced settings.

When I try the app though (both native in testflight and on preview), the progress bar on one user’s home screen does not update when another user makes a change, until the page is refreshed (by either navigating away and back, or pulling down to refresh the screen).

I would really like this progress bar to auto update whenever the record is changed, even by a different user. I thought the “auto update” setting on the list would do this, but it doesn’t.

Is there any way to make this happen?

Thanks!

Try my suggestion from this post

Let me know if it works or not

1 Like

Hey @GOB,

This is related to the way Adalo renders pages and refreshes data.

You didn’t specify how do you get this value of progress. So for example, let’s assume you’re using Logged-in User → Progress value.
When you open the page, Adalo app sends a request to backend to get the record details for Logged-in User. It gets the progress value along with all details and then renders the page and progress bar.
If you change progress value after page is rendered, the app won’t know about it as there is no active client-server connection.

When you press a button, the page is re-rendered (even if there is no action on a button), so data is loaded again from the backend. Therefore the new value is received and progress bar is updated.

Now let’s see how lists with auto-refresh work. Basically, such list sends a request to the backend every 1…2 seconds and loads data again. By the way, that’s why putting too much autorefreshing lists can reduce app speed.

So as you can understand, when you put a list of Users on a screen and turn on list auto-refresh, the data is reloaded, new value is received and progress bar is updated.

However, if you put a list of another separate unlinked collection (e.g. Items) on this screen and turn on auto-refresh, the progress bar will not update. The reason is that Users info isn’t refreshed with Items, Adalo app doesn’t send request to a backend which aren’t needed.

Keep in mind this can be more complicated when you have collections with relationships: Adalo can load data quite intelligently and may request other collections as well.

The case of “refreshing” the screen is pretty frequent when you update the value from other sources, e.g. Make scenario. What I usually do - I wrap the element into a list, make it a single-item list so that it’s filtered to a current one element (if it is a list of Users - make it a list of Users where user email is equal to logged-in user email), and turn on autorefresh.
Another option is to do the same wrapping with an invisible label. The key is that this list should be a list of the collection in question (if we’re refreshing some Item - it should be a list of Items, etc.).

Best,
Victor.

1 Like

Thank you so much to all for the replies @Victor and @Rozza - it is great to get a deeper understanding of how things work. I’ll try some approaches now. Here are some screenshots showing more info on how I am currently doing it.

I have a list that shows a maximum of 1 item.
It is tied to a collection called “Daily Records”.
In that 1 list item are 4 progress bars.
Each progress bar is filtered in three fields in the “Daily Records” - Date, Color, and Organization.

Those fields get updated by users on a different page with a button that has an action that updates those fields in the “Daily Records” collection.

Hope this additional info helps, and again thanks so much for the input. I really appreciate it.

EDIT to add:
FYI here are some images for how I am updating the Daily Record:

Hi @GOB,

Ah ok, you’re using counts. This makes things more complicated. Counts aren’t updated even when the list is refreshed - they’re calculated when you render/refresh a page.
Example: on the first screenshot I’m counting the number of items which contain “x” in name:

And here I’ve removed “x” from some items. List was refreshed, but counts are the same:

So in your case you might want to explore the following options:

  • see if you can store the values from counts in some variable (DB property)
  • implement an “auto-refresh” routine for the page. I’m not a big fan of such hacks, but you can do it using countdown timer which has conditional visibility (Logged-In User → Timer Visible=TRUE), set the timer to 60 secs, then when timer finishes update Timer Visible to FALSE and link to “refresher” empty screen; on the “refresher” screen add on-screen-enter actions to update Timer Visible back to TRUE and link back. Should work like a refresher.

Best regards, Victor.

Thanks @Victor - this is really helpful to know.

I will try the approach of adding a new DB entry for count, but this will be a challenge since I need to increase the count based on color, day, and organization - and be able to separate those out for display.

It’s unfortunate because the current configuration works very well, just not for the updating issue!

Thanks again for the help!

1 Like

Some progress @Victor

Here’s what I’ve done so far:

For now, I can make do with only looking at today’s records, but still need to separate out by organization, each of which has many members.

In the Organization’s collection, I added 4 new properties (of number type):

dayGreen
dayYellow
dayOrange
dayRed

So now when a user makes a choice for that day, I would need to increase that corresponding field by one.

I would need to reset all those values, though, at the start of each day.

Is there a way to reset those values (dayGreen, dayYellow, etc) at the start of each day? even if no one has the app open?

Thanks again!

I’m trying an using zapier to trigger this every day (not my ideal solution but could work)

It’s annoying that I have to make a seperate action in zapier for each ID in the collection - instead of specifying “all” - this means that if I create a new organization on the app I have to go to zapier and add the action for the next ID.

Can you GET all organisations then loop through them, nesting the necessary actions on the loop?

Hi @Rozza - that sounds promising but I could use some more guidance on what you mean.

I appreciate your help and attention!

Get all from Organisations. (A list of all organisations)
For each loop, update record. (For each organisation, update that record)

FYI you can clear an Array in adalo via the Adalo API with []

Hi @GOB,

Option 1: you can use something like Make for this purpose. Note: you will need to have Adalo Collection APIs enabled on your plan - for new users now it’s only on Team and Business plans.
In Make you can create a scenario which is run daily, it should loop over the records in Organizations collection and reset these values.

Option 2: a workaround, but it could work in your particular case.
Let’s assume that when a user opens the app and gets to Home screen, we have an access to user’s organization.
Then let’s add a datetime property to Organization collection, and call it “last time values reset”.
And then let’s add a on-screen-enter action, which:

  • resets values for the organization of the user
  • and also stores the current time in Organization → last time values reset.
    A final part: make this action conditional, so that it is executed only if Organization → last time values reset is earlier than start of today.

As a result: when a user from a certain org opens the app on a certain day, the values should be reset (as the last time values reset are in the past compared to start of the day). Another user which opens the app won’t have this action executed as the last time values reset is later than start of today.

Please note: the workaround above requires testing and might require enhancements. E.g. I didn’t address the issue of users in different timezones - so maybe it’s better to store the reset time in a date format or in a numeric format. Also you’ll need to test if the data is pulled correctly from the backend to a home screen. And yes, it doesn’t meet your requirement “even if no one has the app open”.

Best,
Victor

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