Create an ECSQL built-in function like ‘ec_clanname() and ‘ec_classid()’. It could have this form:
ec_getPropertyUnit( ecclass, ecproperty )
Its functionality is to pull the component's unit of measurement (UOM).
| How frequently will feature be used? | A few times a week |
| How much time will you save? | It will save us time to hardcode (ie CAST(equip.DRY_WEIGHT AS TEXT) || 'kg' as [DryWeight]) the UOM into the query for a property that's readily available in OpenPlant |
| Your Industry | Process Manufacturing |
ECSQL provides functionality to fetch queries of classes and properties. For instance a query to fetch unit of measurement for all properties and classes in iModel and display them in a grid can be:
SELECT
c.Name AS ClassName,
p.Name AS PropertyName,
koq.Name AS KindOfQuantityName,
u.Name AS UnitName,
u.DisplayLabel AS UnitLabel
FROM meta.ECClassDef c
JOIN meta.ECPropertyDef p ON p.Class.Id = c.ECInstanceId
JOIN meta.KindOfQuantityDef koq ON p.KindOfQuantity.Id = koq.ECInstanceId
JOIN meta.ECSchemaDef us ON u.Schema.Id = us.ECInstanceId
JOIN meta.UnitDef u ON TRUE
Where koq.PersistenceUnit = us.Alias || ':' || u.Name
OR koq.PersistenceUnit = u.Name
This query will result soemthing like this (results may vary depending on data in iModel)

This query can be created in a project and saved as shared query.