- Log in to post comments
You've stated
"
To use background cube updates in our example, you need to add DSTIME and DSINTERVAL parameters to the %SYS.Audit system class and compile it.
Changes in %SYS.Audit:"
but this is an Intersystems class and I suspect should not be edited as any edits will be overwritten with a product upgrade. Isn't this correct?
- Log in to post comments
If I was asked to do this the one change I would do/have done in the past is implement the class method with sql code vs object code. Whether you are using a storage strategy based on CacheSQLStorage or CacheStorage when you open an object all of the properties that are stored in the global are "swizzled" into memory and allocated a memory location so that later on when you do object.property you have the value. In your specific question, you want the total of all charges from the parent. I would do something like
&sql(select sum(Amount) into :Total FROM FreightChargesDetail where Freight=:currentID)
in truth when I have done this I've actually not used a class method at all but rather in my SQLComputeCode I would do something like
{
New ParentId,Total Set ParentId={%%ID} &SQL(SELECT SUM(Amount) into :Total FROM FreightChargesDetail where Freight=:ParentId) Set {*}=$Get(Total)}, SqlComputed, Transient ];
A couple of reasons.
- I do not see a reason to expose an interface/classmethod that gets the total as it's already satisfied by the property definition.
- I do not believe SQLCompute code is implemented inside of a procedure so any local variable should be New'ed so that do not flow out of the stack.
- Log in to post comments
In the past when I've had to do something like this I've leveraged https://docs.intersystems.com/irislatest/csp/docbook/DocBook.UI.Page.cl…. In the custom Execute method I would accumulate all of the data and place in a process private global. In the Fetch method, I get one row out of the process private global at a time.