Slow Input Calculations

How do you typically deal with calculations being slow on the backend. A basic example is doing basic math on two inputs that relate to database fields. I very often get strange results because what appears is that the calculations are happening too slow and one field is changing before the math is done.

1 Like

Yes, this is a problem. There are multiple workarounds I’ve tried. Nothing is perfect. The best I’ve found is this.

Have it calculate on the client side (i.e. Input 3 = Input 1 + Input 2)

Then set up your workflows:
#1 - when Input 1 value is changed, trigger Calculation Workflow
#2 - when Input 2 value is changed, trigger Calculation Workflow
#3 - Calc Workflow (custom wrkflw): Make changes to database (input 3’s corresponding value): Value = Input 3’s value

This way all the calculations are happening client side without going back and forth to the database where the lags happen, causing miscalculations.

I’ve spent many hours fooling around with this stuff.

A belt and suspenders approach is to have a workflow periodically “check” values against a total or checksum number, and if there is a mismatch (i.e. calculation error), it can run the calculations again in the background. The user won’t notice anything since the calculations they are seeing are client-side from the inputs (not the database).

1 Like

This topic was automatically closed after 70 days. New replies are no longer allowed.