Hi.
I have a general question regarding the efficiency of a webapp. If i want to display calculated values, should i store them in variables in the dataset and display them from there whenever needed or should i calculate those values in real time on the display panel itself rather than storing them. Which approach is better speed and WLU wise?
Depends on:
- How complex it is to calculate
- How often users calculate it
For most calculations it would be cheaper to store it on the data type and recalculate them when the data type changes using a backend trigger. That also has the advantage of making the calculation be in only one place in your app - if you need to change it later, you don’t have to find everywhere it’s used.
This depends on the type of calculation and what is required to calculate it…if you only need to do some simple things like adding, multiplying etc. which can be done via dynamic expression mathematical operators, you would be much better off just calculating them in real time via the dynamic expression mathematical operators, since that doesn’t cost anything.
If however, you are unable to get it done via on page dynamic expressions (in my experience it almost always can be when creative enough) then you may want to have a data field with the calculated value, but of course that will cost WUs.
In terms of creativity for calculations, using input elements that are hidden or visible as values for ‘intermediate results’ of a complex calculation or having groups that are of type number with a data source being a dynamic expression that does the calculation.
I’m thinking of cases where calculations require searches. For example, I’m working on an R&D tax credit app right now which is very calculation heavy, so to run searches on all of the relevant data types then add all the values is wildly inefficient both in terms of WU and speed compared to just updating it whenever the thing changes.
This topic was automatically closed after 70 days. New replies are no longer allowed.