with everyone's help, it was possible to create a property with the same behavior as VALUE LIST from the parameters of a class.
below is the test code:
First create the abstraction
Class ing.shared.abstracts.AbstractEnum [ Abstract ]
{
ClassMethod BuildValueList() As %String
{
Set valueList = ","_..GetValuesOfParametersString()
Return valueList
}
ClassMethod BuildDisplayList() As %String
{
Set displayList = ","_..GetParametersString()
Return displayList
}
ClassMethod GetValuesOfParameters()
{
Set parametersList = ..GetParameters()
Set valueList= $lb("")
For i=1:1:$LISTLENGTH(parametersList){
Set value = $PARAMETER($CLASSNAME(),$LIST(parametersList,i))
Set $LIST(valueList,i) = value
}
Return valueList
}
ClassMethod GetParameters() [ CodeMode = objectgenerator ]
{
Set parametersClass=""
For i=1:1:%class.Parameters.Count(){
Set parametersClass=parametersClass_$LISTBUILD(%class.Parameters.GetAt(i).Name)
}
Do %code.WriteLine($char(9)_"Return """_parametersClass_"""")
}
ClassMethod GetParametersString() As %String
{
Return $listtostring(..GetParameters())
}
ClassMethod GetValuesOfParametersString() As %String
{
Return $listtostring(..GetValuesOfParameters())
}
}
Second I created the class with the parameters, containing extension of the abstract class
Class ing.dto.AbstractionItemSectorStatus Extends ing.shared.abstracts.AbstractEnum
{
Parameter Active = 1;
Parameter Inactive = 2;
Parameter Production = 3;
Parameter Upkeep = 4;
}
Create a datatype class referencing a parameter class in your property:
go to post
Hello everyone !
I thank the help of all!
with everyone's help, it was possible to create a property with the same behavior as VALUE LIST from the parameters of a class.
below is the test code:
First create the abstraction
Second I created the class with the parameters, containing extension of the abstract class
Create a datatype class referencing a parameter class in your property:
And finally create a Persistent class:
This architecture can be useful for future code maintenance, creating or changing new abstract classes
go to post
Thanks !
Is possible to use the return of the Method to build the VALUELIST ?
Or other property with the same purpose?
go to post
Is there a function that returns a string or list with all the parameters of the class?