Update all users

Hey all, I am trying to find a way to update a true/false property on all users once a new user is created. So when a new user is created; update all users; True/false property= False.

1 Like

So you want user when he sign up it updates the WHOLE users?

Yes I want all the other users in the app to be updated when a new user signs up. It needs to change a true/false property once a new user signs up

To get me testing before I say me results, you want when I new user sgin in every gets true, but when another user sgins in stays true?

When a new user signs up; all others users true/false property changes to false.

And stays false right?

1 Like

Let me test all possible ways as adalo doesn’t allow except “logged in user”…

Thank you I appreciate the help!

So all users have a true field until a new user comes and turns it false?

So some users will be false and some will be true but all need to be false when a new user is created.

Hey colleague!

When the user signs-up, is redirected to screen TEMP

In the screen TEMP, you use this trick: Trick: Bulk update records, with an invisible list, and countdown timer = 1sec. There you update all the users properties to FALSE.

Also, create another countdown with 2/3secs (out of the list) that will redirect to the new screen.

In the TEMP screen, you can write something like “LOGGING IN…”, and a loading GIF, that is shown while all this is happening in the background

Hope to have been helpful! :slight_smile: let me know if that works!

Paolo

1 Like

That sounds like it will work! Thanks! I will give that a try and update here if it worked.

Be careful tho, it may update also the logged in user.

Worked, nice job. :slight_smile:

Yup, this worked. Thanks again!

1 Like

Hi @rjones @montetennis,

Just my 2 cents: bulk update of 100s of records sometimes may take a lot of time.

In my experience, when I needed to reset 84 records, it took about 15-30 seconds to have a result. Please keep in mind, countdown timer executes on a client side, so it’s not very fast.
This was before Adalo made some improvements with the speed, but still, I’d recommend to test it first.
When I tried to do an update for 700 records, the console was frozen for couple of minutes :slight_smile: And if your app is successful, you might hit these figures quite soon.

One of the possible ways to make bulk update in the background is to use something like Integromat. However, this solution is also not very fast, and each update operation consumes a “credit”, so frequent bulk updates might be costly.

My biggest concern would be reg. the task itself: why would you want to update all “old” user records when a new record is created? What’s the goal you’d like to achieve? May be there is another way to do it :slight_smile:

Just my 2 cents

Best regards, Victor.

Is the console crash after that and you need to refresh ?

Do the records successfully updated ?

Sorry, just curious

1 Like

I agree with Victor comments.

Probably my solution is just a patch that is working up to 100 users…

If what you want to achieve is keeping track of “last user” you can track the “created time” of the user, instead setting all FALSEs to the other user

1 Like

Hi @Yongki,

No, it didn’t crash. The browser just became unresponsive. Macbook Air (not M1 but previous), Chrome, 8GB RAM.
It’s interpretation - imagine the load on your device when a timer tries to execute 700 operations at the same time :slight_smile:

They were updated, eventually. The thing is, that I don’t really like such approaches - there could be unforseen consequences when the number of records increases. So there should be another way :slight_smile:

Best regards, Victor.

@Victor

Thanks for your explanation.

To split the operation, I use maximum number in the list, so that it run in batches.

Yes, using countdown workaround is not best practice, Adalo should make new component for this batch update.

But, the good news, the database is updated, this proves that their backend is consistent, but unfortunately slow.

Hopefully when the time comes, there will be low-code that can translate to SQL for database operation so that performance will be faster.

1 Like