Esko Logo Back to Esko Support
Choose your language for a machine translation:

 

Summary

If you use .length in, for example a text attribute value in the WebCenter Execute JavaScript workflow node, it always returns 0.

Symptoms

For example: the following script reads the value of the attribute Text but has unexpectedly 0 in the variable length:

  1 var project = API.getProject();
  2 var attr = project.getAttribute("Text");
  3 var value = attr.getValue();
i 4 var length = value.length; // always returns 0

 

Solution

  • Convert the value to a native JavaScript string first (see line 3):

      1 var project = API.getProject();
      2 var attr = project.getAttribute("Text");
      3 var value = "" + attr.getValue();
    i 4 var length = value.length; // returns the correct length


  • Upgrade to WebCenter 18.1 where this issue will be fixed
Article information
Applies to

WebCenter 16.1 and newer until WebCenter 18.1

Created06-Mar-17
Last revised 
AuthorBAMT
Case Number 
Contents