Written by

Principal Integration Architect | Cloud Computing | Data Science | AI & ML | CSM
Question Neerav Verma · Nov 28, 2019

Getting Parameters cleanly from Property Definition

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

Comments

Peter Steiwer · Nov 28, 2019

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

0
Neerav Verma  Nov 28, 2019 to Peter Steiwer

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

0
Neerav Verma  Nov 28, 2019 to Eduard Lebedyuk

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 .

0
Neerav Verma  Nov 28, 2019 to Eduard Lebedyuk

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

0
Eduard Lebedyuk · Nov 28, 2019

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?

0
Eduard Lebedyuk  Nov 28, 2019 to Neerav Verma

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
}
0
Eduard Lebedyuk  Nov 29, 2019 to Neerav Verma

Add

Include %occKeyword

to the beginning of the class.

0
Alexander Koblov  Nov 29, 2019 to Neerav Verma

Also write

quit:(param = "")

instead of

quit:param = ""
0
Neerav Verma  Nov 29, 2019 to Neerav Verma

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

0