select r_object_id, attr_name, default_value from dmi_dd_attr_info where type_name = '
or for a specific attribute:
select r_object_id, attr_name, default_value from dmi_dd_attr_info where type_name = '
default_value returned from the query is an object ID pointing to an expression object, and from there, you can get the value of the expression_text.
For an example, check out ypli_type081502 type with attribute attr1 in qa_client2 docbase. . You'll see that the default_value returned is 53016e8d80003913. Dumping this ID will show you the structure of this object, including "expression_text". You probably can optimize by putting the two steps into one query.
2. Another method is to get to it through IDfSession.getTypeDescription.
This method is ok if you are not getting the default value info for a lot of attributes, or performance is not a main concern for the customer. One getTypeDescription call can add about 0.5 second of overhead.
IDfTypedObject tobj = IDfSession.getTypeDescription (
// loop to get all default values (it is a repeating attribute)
{
IDfId defValueId = tobj.getRepeatingId ("default_value");
IDfPersistentObject pobj = session.getObject(defValueId);
String defaultValue = pobj.getString ("expression_text");
... // manipulate the default value
}
3. The quick and dirty way is:
create an object of that type (don't save), and retrieve the attribute value.
This is not a good idea for production code. Just ok for ad-hoc testing.
1 comment:
May your day be as bright as a sunny afternoon!My site:King88
Post a Comment