Label expressions are not supported for data-object

Started by rheward, March 09, 2023, 15:38:04 PM

Previous topic - Next topic

rheward

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}");   
})


Phil Beauvoir

Hi, label expressions can only be set on visual objects in a View, not concepts. Your first example is returning a concept.
If you value and use Archi, please consider making a donation!
Ask your ArchiMate related questions to the ArchiMate Community's Discussion Board.

rheward

Ah, of course. Makes sense now. I was trying to default it for when it does become a visual object.