Needed Class Parameter specification and use that works SQLComputeCode
In trying to define a Class Parameter that I can use in SQLComputeCode I can't seem to get any of the syntaxes for the using of the parameter where the SQL compute code will actually evaluate the parameter values. There is nothing specific that I can find in the docs about SQLCompute Code and Parameter usage.
Is there some specific syntax for accessing a class defined parameter in the SQL Compute Code that works?
This is on: IRIS for Windows (x86-64) 2022.1.1 (Build 374U) Tue Oct 18 2022 17:37:34 EDT
SQL Compute Code runs outside the class context, in that circumstance you can use:
##class(YourPkg.YourClassName).#YourParamName
Enrico
Or try
$parameter("classname", "paramname")
I tried this and it worked:
Parameter TestParam = "Test";
Property TestCalc As %String [ SqlComputeCode = { Set {*} = ..#TestParam}, SqlComputed ];
[SQL]SAMPLES>>select * from DC.SQLCompute
1. select * from DC.SQLCompute
ID TestCalc
1 Test
Often SqlComputed is used for properties that are also calculated like:
but in that case ..#ParamName does not work, this works:
Enrico