I have a screen where businesses can create quotes. There is a repeatinggroup of Quote Line Items.
Each quote line item has a bunch of fields associated with price which are autobound to the db: Unit Price (input); Quantity (input); GST/Tax (checkbox).
I have disabled inputs for GST Tax Amount, and Total Including GST/Tax. Both these fields are autobound to db fields, and I have a trigger (backend workflow) on the Quote Line Item that recalculates these if unit price, quantity or gst/tax applicable are updated.
Everything works well, except there is a 1-3 second delay before user sees the updated gst and total amounts… I’m thinking that this would only be worse when in production and lots of different workflows happening at the same time.
Is there a better way to do this? I was thinking maybe I could use a custom state and “when input is changed” workflow, but not sure fully on the best way.
Just looking for some general advice/guidance/best practice.
you can move the calculation to front end and then just send it to the backend
normally I’d use groups to hold numbers (set the data type to number on the group) and then do the math in the groups
this way the math is done instantly on the page and there is no delay as it doesn’t touch the server at all (until it is sent and saved on form submit)
this works fine for totals and things
for line items I usually edit in a popup and then animate the close to delay the user a little bit as the data is returned from server to the repeating group and the onpage calcs are recalced
you’ll notice a lot of checkouts do this - they calc line items at point of adding to the cart. then distract the user with a checkout process (enter your details) whilst calcs happen on the server and are returned to the page
a few smoke and mirrors makes the checkout feel instant