Question
· Aug 3, 2017

Accessor function for a parameter

Hi community,

I have some constants hardcoded in my class as parameter values, and those constants are referenced in many places in my module. Now the need has arisen to provide different value for those parameters depending on some context. Is it possible to create some sort of accessor method for the parameter (like it is possible for properties), or do I need to perform a thorough refactoring?

Thanks.

Jiri

Discussion (1)0
Log in or sign up to continue

You can define a parameter as an ObjectScript expression that it is evaluated at runtime. To do so, specify its type as COSEXPRESSION and specify an ObjectScript expression as the value:

Parameter PARAMNAME As COSEXPRESSION = "ObjectScriptExpression";

where PARAMNAME is the parameter being defined and ObjectScriptExpression is the ObjectScript content that is evaluated at runtime.
An example class parameter definition would be:

Parameter DateParam As COSEXPRESSION = "$H";

Documentation.

That said, I'd recommend gradual refactoring of these parameters into methods.