FormulaScript typeof returns "object" instead of "string"

  • 7006551
  • 02-Aug-2010
  • 26-Jun-2012


Business Service Manager 4.5
Business Service Manager 4.6
Business Service Manager 4.7


The typeof function doesn't appear to work against strings that come from BSM objects.  Things like element.dname and alarm.description return object as their type. 


FormulaScript accesses Java objects running in the BSM client and server.  Although these objects are similar to FormulaScript objects, in some ways they are different.  Java strings are different from FormulaScript strings and so are considered objects by FormulaScript.  In most cases this doesn't matter:  FormulaScript will convert a FormulaScript string to a Java string when calling Java code, and the two types have the same methods.  If it's necessary to convert from one to the other, it can be done as follows:

FormulaScript to Java:

var javaString = new java.lang.String(formulaScriptString);

Java to FormulaScript:

var formulaScriptString = "" + javaString;