Force recalculation of formula for clients

Hey,

I have booking system for my clients using baserow.
The heart of the system is table v1_klienci ( clients ).
It is connected to v1_booking_sesje ( booking ) , v1_sprzedaz ( sale ).

Based on v1_booking_sesje and v1_sprzedaz I calculate how many specific services are being bought and used by client.

For example:

  1. calculate on how many services client already used up to today:

field: sesje_NK:

count(
filter(
field(‘v1_booking_sesje’),
lookup(‘v1_booking_sesje’, “is_NK”) &&
not(lookup(‘v1_booking_sesje’, “is_FUTURE”)) &&
not(lookup(‘v1_booking_sesje’, “deleted”))
)
)

  1. calculate how many services he bought already:

field: karnety_NK:

sum(lookup(‘v1_sprzedaz’,‘ilosc_NK’))

The problem is that sesje_NK is not updated - i need to update it manually by changing formula ( adding space ) for recalculation.

Clients doesn’t have updated info about their orders and usage of services in real time, but only once per day .

Crazy !

How to fix that ?

hey @parhelium

Is the problem happening on baserow.io or self-hosted?

Can you share more what is_FUTURE really is?

Is it possible to share workspace export (structure only is enough) - it could be in private message. That would help finding out what actually happens.

hey @Przemek

Self-hosted

Is_FUTURE:
field(‘when’) > now()

TBH, I don’t know how to export workspace without revealing production data. Any hints ?

Hey @parhelium, here’s how: Export Baserow workspace data

Just make sure to check Export structure only to export table structures, fields, views, and configurations WITHOUT data rows.

In the meantime I updated formula :
field: sesje_NK:

count(
filter(
field(‘v1_booking_sesje’),
lookup(‘v1_booking_sesje’, “is_NK_WITHIN_TODAY”)
)
)

field: is_NK_WITHIN_TODAY

field(‘is_NK’) && field(‘when’) <= now()

field: is_NK

field(‘deleted’) = false &&

any(
or(
or(
lookup(‘usluga’,‘abr’) = “NK”,
lookup(‘usluga’,‘abr’) = “NPF”
),
or(
lookup(‘usluga’,‘abr’) = “N”,
lookup(‘usluga’,‘abr’) = “ND18”
)
)
)

The same issue happened.

My intuition says it is connected with:

field(‘is_NK’) && field(‘when’) <= now()

What would trigger Baserow recalc when now() changes every ms.
If that recalc will happen minimum every 15 min then would be enough for me.

now() in formulas is recalculated every 10 minutes.

This can be controlled with BASEROW_PERIODIC_FIELD_UPDATE_CRONTAB

Thanks, Przemek.

What could be the reason ? Why it is not recalculated ?

I need to manually trigger recalculation by editing formula of the fields…
Usually I’m adding white space and click save and it does the job.

It is strange situation. During weekend there was no recalculations.

However it works perfectly when I test it manually:

  1. Manually add client to session ( in table v1_booking_sesje ).
  2. Refresh browser tab where v1_klienci shows sesje_NK
  3. After refresh value at client’s sesje_NK and other dependent fields are properly calculated

It seems when I watch it works like a charm, when weekends start and I’m not starring at self-hosted baserow it become lazy ! :sweat_smile:

Again, today I have to manually edit all fields ( by adding white_space to the end) sesje_NK, sesje_BK, to force recalculation…

I need to do that on daily basis in the morning, so clients see proper values in their dashboards.