Hi guys,
This is probably the expected behaviour but I’ll just make sure.
With an unstored calculation the value is updated as soon as any of the calculation components change.
Say, I have ‘a() { return b + c; }’ as my calc and whenever I change b or c - my ‘a’ will change right away.
With the stored calcs, ‘a’ will not be changed until I save changes to ‘b’ or ‘c’.
This creates the necessity for me to have two calculations on the same table doing the same thing because I want to store the value (reporting) and I also want to access the realtime changes.
Am I doing it right?
If so, is this something that can be made consistent?
Cheers,
Maria
maria.kyselova:
This creates the necessity for me to have two calculations on the same table doing the same thing because I want to store the value (reporting) and I also want to access the realtime changes.
What reporting tool are you using?
In case of JasperReports, the plugin will take a foundset as datasource, which includes unstored calculations
mboegem:
maria.kyselova:
This creates the necessity for me to have two calculations on the same table doing the same thing because I want to store the value (reporting) and I also want to access the realtime changes.
What reporting tool are you using?
In case of JasperReports, the plugin will take a foundset as datasource, which includes unstored calculations
Hi Marc,
Yes, we use JasperReports. Our programmer ran into trouble when he developed grouping by an unstored calculated field I think. Also, as far as I remember we cannot sort a foundset on unstored calcs. This is why we have to store them. As long as we’re on it, Marc, do those limitations still exist?
But it’s not only about reports. I can’t .search() on unstored calculations and our search engine is relying on calculated figures for things like invoices, jobs, quotes, etc. a lot. So I have to store them.
Anyway, in some cases we just can’t get rid of a stored calc.
What I’d like is a confirmation that the above is how they are supposed to work or it’s a bug.
Cheers,
Maria
Maria,
A stored calculation is stored in memory the same as a regular column.
From your example, if you change b, the value is also not in the db until you save.
The same is for the calculated a, the only difference is that the value is adjusted automatically.
From your question it seems that a stored calc is not updated in memory immediately.
That should not be and is a bug if you see that, then please show it in a small sample and file a case in our support system.
The only difference between a stored calc and a non-stored one is that a stored calc is saved in the column with the same name.
About foundset sorting, foundset has a sort method with a sorting function, you can use this to sort on unstored calcs.
But beware that this will load the entire foundset in memory since sorting is done in-memory and not in the db.
Rob