You can remove the Calculated keyword and use a combination of SqlComputeOnChange and Readonly keywords.
What you accomplish:
- Removing Calculated keyword, makes the column persistent
- Adding SqlComputeOnChange gives you control on when you want the value to be calculated (using %%INSERT or %%UPDATE) and based on which column (don't add any if calc must happen for all inserts regardless of which fields are being inserted).
- Adding Readonly just provides and extra "safety" that the value can't be changed via SQL or Object means.
Property readonlyprop As %String [ ReadOnly, SqlComputeCode = { S {*} = {ID}_(+$H)}, SqlComputed, SqlComputeOnChange = %%INSERT ];- Log in to post comments