Where does Stored Calculations store Data?
Today, a customer asked me: Where do stored calculations store data?
api.Data.Calculate If Statements
In stored calculations, If Statements are helpful to specify that a formula is only required to execute on specific Data Units, as shown in the image below.
If ((Not api.Entity.HasChildren()) And (api.Cons.IsLocalCurrencyForEntity())) contains two logical operators (And and Not). Due to the AND operator, the statement api.Data.Calculate("S#Forecast = S#Actual") between Then and End If will only run if both of the following are true:
- The Entity is a Base-level Entity Member, i.e.: does NOT have Children (Not api.Entity.HasChildren())
- The Consolidation Member is Local indicating the Entity Member's local currency (api.Cons.IsLocalCurrencyForEntity())
The statement api.Data.Calculate("S#Forecast = S#Actual") will copy the S#Actual data buffer to the S#Forecast data buffer. The If...End If is limiting the calculation statement to execute only for specific Data Unit Dimension Members.
Other consideration to take into account when creating store calculation rules. 💥
api.Data.Calculate("A#CashCalc=RemoveZeros(A#10000)") uses the RemoveZeros function to remove cells with No Data or 0.00 cells in the A#10000 data buffer. The results are stored in the A#CashCalc data buffer. The RemoveZeros function is to help with performance if there are large amounts of No Data or 0.00 cells.
END IF 😂😀😃