I'd like to create an object, add a property, then set its Label Expression. It's the Label Expression that fails..
Create a data-object called Bill and add a property called "AltName", value Fred.
var obj = $(".Bill").first();
console.log(obj.prop("AltName"));
obj.labelExpression = "Joe";
//obj.labelExpression = "${property:AltName}";
I'm getting:
Fred
javax.script.ScriptException: com.archimatetool.script.ArchiScriptException: Label expressions are not supported for data-object: Bill
I think I'm referencing the wrong kind of object? :-[
If I do in a loop, it's fine (but I want to do it for the new one I've just created.
selection.filter('element').each(function(e) {
e.setLabelExpression("${property:AltName}");
})
Hi, label expressions can only be set on visual objects in a View, not concepts. Your first example is returning a concept.
Ah, of course. Makes sense now. I was trying to default it for when it does become a visual object.