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
  • I think a runtime equivalent of PutInternationalString(lcid, value) will be required but I'm not sure if something like that is available or not.

    Just setting the text like a normal string will not do, since it is quite common to see applications where the server (or the AppEngine credentials to be specific) is running with a different locale than that of the clients, which can cause all kinds of confusion. You probably need to have one line of script to update each locale supported by the specific application. Come to think of it, it could perhaps be useful if one could submit a collection of lcid/text pairs to a method and sett multiple locales in one shot.

    For sure, using GRAccess to set the attribute value will require that you also deploy changes to the affected object which seems contraproductive and using GRAccess in runtime is potentially problematic in terms of messing with default values. Sorry, I know you've heard my rant about runtime GRAccess many times before Smile

  • Hi Rickard Slight smile

    I Agree, GRAccess is not my endgame here, but it visualizes the need I'm trying to show.

    I am not aware of any other way of setting Internationalized string in the correct datatype, and I was just aiming to claim the datatype from GRAccess, not setting the description in design time.

    But it caught your attention and I count that as a win!

Reply Children
No Data