getFirstInstance
Funtion to get the first instance of a familySymbol
(
$getFirstInstance := function($parentId) {
(
$first := $[type = "FamilyInstance" and parent.id = $parentId][0];
$exists($first) ?
$map($filter($keys($first.values), function($key) {
$substring($key, 0, 2) = "p_"
}), function($key) {
$substring($key, 2) /* Remove the "p_" prefix */
}) : []
)
};
$filter(
$[type = "FamilySymbol"].{
"type": type,
"id": id,
"name": name,
"mergedSharedParameters": $append(
$getFirstInstance(id),
$map($filter($keys($.values), function($key) {
$substring($key, 0, 2) = "p_"
}), function($key) {
$substring($key, 2) /* Remove the "p_" prefix */
})
)
},
function($symbol) {
$exists($symbol.mergedSharedParameters)
}
)