Setting .Description / .DescAttrName / .ShortDesc in scripting

Hi, 

As Language support on Objects was introduced in Application Server it will no longer allow for scripts to write to .Description of a object attribute.

As we have several customers with solutions where this is used in different ways (and for different reasons) we explored a workaround for this.

So the following will not work anylonger and data will not change in runtime

MyValue.Description = "This is nice";

Reason for this is that the .Description is now an datatype InternationalString.

The only workaround we have found so far is to change the Type of the primitive back to MxString, ie in OnScan of the Object.

This will allow for runtime updates from scripts in new versions.

The effect of the Type change is that Initial value is lost (Empty until set script executes), but we can now update the Description

The following will fix the issue of Empty, but it means that Initial value set in design time is discarded.

I would expect same applies to any non referenced description, such as .DescAttrName

Here the workaround seem to break down some. and a normal case is that .DescAttrName (Alarm description) is set to Me.MyAttribute.Description

Result is that it will use the design time value, and not update in runtime.

What I'm looking for is a way to set the description in a proper way in runtime.

I was trying the following without any success.

Since we have at least five customers at the moment where this is an issue, I would like to explore if anyone here has any experience in resolving this change in behavior?

Parents Reply Children
  • Alright thank you for replying.

    We're currently using an onscan script to set the alarm message like this:

    me.Alarmmessagetxt = "High level - " + me.shortdesc;

    So that the operators also see a "friendly name" of a component. (Tank 1 temperature sensor). And now we need our application to fucntion with multiple languages.

    But it breaks language support. Even though Alarmmessagetxt and shortdesc are translatable individually, concatenating them at runtime breaks the translation.

    We also tried:

    Fault.DescAttrName = me.Alarmmessagetxt + me.shortdesc;

    Same issue—dynamic strings aren't processed by the localization system, so translations don't apply.

  • There is currently a feature to make at least the Description writeable at runtime. We will also try to do the same for other InternationalizedStrings that were writeable when they were still strings.

    The good news is that so far, it has been prioritised for the SP 2026 release in Q1 next year — as always, these things are subject to change depending on a million other things, but so far, I am still hoping to get it done...Fingers crossed