2022-12-15

SQL query to extract default (initial) value of a value property

I am trying to create a custom template fragment that builds a table of value properties. I started by creating a SQL query fragment that pulls all properties classified by a Value Type. Now I would like to pull in the default (initial) value assigned. I figured out that it's in the Description table of t_xref, with the property guid in the client field, but I don't know how to write a query that will reliably parse the default value out since the string length may be different depending on other values set. I tried using the template content selector first but I couldn't figure out how to filter to only value properties. I'm still using the default .qeax file but will be migrating to a windows based DBMS soon. Appreciate any help!

Tried using the content selector. Successfully built a query to get value properties but got stuck trying to join and query t_xref for default value.

Edited to add current query and image Value Properties Example

Value Properties are block properties that are typed to Value Types. I'm using SysML.

This is my current query, I am no SQL expert! I don't pull anything from t_xref yet but am pulling out only the value properties with this query:

SELECT property.ea_guid AS CLASSGUID, property.Object_Type AS CLASSTYPE, property.Name, property.Note as [Notes], classifier.Name AS TYPE   
FROM t_object property   
LEFT JOIN t_object classifier ON property.PDATA1 = classifier.ea_guid   
LEFT JOIN t_object block on property.ParentID = block.Object_ID   
WHERE block.Object_ID = #OBJECTID# AND property.Object_Type = 'Part' AND classifier.Object_Type = 'DataType'  
ORDER BY property.Name


No comments:

Post a Comment