User bio
404 bio not found
Member since Mar 17, 2022
Posts:
Replies:
Thanks George,
It's not what i search, I would have the type, not test if is one type.
Hi Eduard,
Thanks for this utility method. I think I will use it for debugging
Certifications & Credly badges:
Pierre has no Certifications & Credly badges yet.
Global Masters badges:


Followers:
Following:
Pierre has not followed anybody yet.
Thanks Julius,
It was exactly what i needed. My goal was to copy properties from a dynamic object to a persistent object, but in dynamic object for reference, I have only id, not a ref.
So i made this : (main class)
Class Bna.Utils.DynToPersistent Extends %RegisteredObject { Property DynObject As %Library.DynamicObject; Property PersistentObject; Method %OnNew(dynObject As %Library.DynamicObject, persistentObject) As %Status { Set ..DynObject = dynObject Set ..PersistentObject = persistentObject Return $$$OK } Method copyDynToPersistent() { set pClass = ..PersistentObject.%ClassName(1) Set iterator = ..DynObject.%GetIterator() while iterator.%GetNext(.pProp, .pValue) { Set pType = ##class(Bna.Utils.Common).GetPersistentObjectPropertyType(pClass,pProp) Set isRef = ##class(Bna.Utils.Common).PersistentObjectPropertyTypeIsReference(pType) if isRef { set value = $ZOBJCLASSMETHOD(pType, "%OpenId", pValue) } else { set value = pValue } Set $ZOBJPROPERTY(..PersistentObject, pProp) = value } } }
(utility methods) :
ClassMethod GetPersistentObjectPropertyType(pClass As %String, pKey As %String) As %String { set def=##class(%Dictionary.PropertyDefinition).%OpenId(pClass_"||"_pKey) if def Return def.Type } ClassMethod PersistentObjectPropertyTypeIsReference(pType) As %Boolean { if $EXTRACT(pType,1,1) = "%" { Return 0 } else { Return 1 } }
I think my test for reference detection can be light, but enough in my context