Getting Parameters cleanly from Property Definition

Primary tabs

HI,

I have made a query with class definitions and all their properties and put them in a view.

All is good besides Parameters is showing junk characters. Is there a way to do it cleanly besides getting into the code??

 

SELECT 
CC.ID As CompiledClass, 
CC.SqlSchemaName,
CC.SqlTableName,
CP.Name As PropertyName, 
CP.SqlFieldName, 
CP.Type,
PD.Parameters

FROM %Dictionary.CompiledProperty CP
JOIN %Dictionary.CompiledClass CC
ON CP.Parent = CC.ID

JOIN %Dictionary.PropertyDefinition PD
ON PD.ID = CP.ID1

Answers

Property parameters stored as an array of strings.

Since parameters are N:1 to property, your theoretical query isn't possible due to cardinality mismatch.

What do you want to get?

I want to get all the Paramaters that are defined for the property such as MAXLEN, MINLEN, VALUELIST, SCALE etc.

The above parameters are possible for different property types but its best to have one column as parameters and display them .

Call this sqlproc passing class and prop names:

ClassMethod Params(class, prop) As %String [SQLProc]
{
    set result = ""
    set param = ""
    for {
        set param = $$$defparamMemberNext(class,$$$cCLASSproperty,prop,$$$cPROPparameter,param)
        quit:(param ="")
        set value = $$$defMemberArrayGet(class,$$$cCLASSproperty,prop,$$$cPROPparameter,param)
        set result = result _ param _ "=" _ value _ ","
    }
    quit result
}

If we open Docbook /Class documentation of any class. It shows the properties with its type and parameters. I just want that but in a view

I resolved it by following the sql proc method and then creating a view with that sql proc within the query.

An object script function seems to be the only way to make it work.

Eduard, your code didn't work most probably because we have an older version. All I did was iterate through all the params and add the key and value in output
Thanks for your help

Comments

What characters are you seeing in parameters that you don't want to be there? How are the corresponding parameters defined?

Properties are simple

String (maxlen=25)

I am seeing lot of junk values in the field.

Square boxes. Parameters is an array In properties class, so may be it's that.

Version is 2013