Problem
Es soll überprüft/abgefragt werden ob ein Attribute eines Objektes existiert.
Das Objekt muss nicht unbedingt im current Module sein (wie im zweiten Beispiel ganz unten).
A check if an object attribute exists shall be performed.
It is not sure if the object is in the current module (like in the second example in solution section).
Ansatz – Approach
Es wird nach Null beim Result bei der AttrDef find-Methode gefragt
By using the AttrDef=find method we can ask for null (not existing)
Lösung – Solution
string getObjectValueIfExist(Object nObject, string attributeName) { AttrDef ad = find(module nObject, attributeName) if(!null ad) { return nObject.attributeName ""; } return "n/a"; }
Im current Module kann auch
if (exists(attribute(string "BB_PlannedRelease"))) { ... }
verwendet werden