com.ergotech.vib.valueobjects.StringValueObject

Description

The String Value Object (sometimes referred to as “SVO”) is a type of Value Object that is contains text (Strings).

Many manipulators in the “String” category can be used to combine or create String Value Objects. If the text in a String Value Object can be converted to a number it can be used in mathematical manipulators that take numeric inputs.

The Random String Server may be used to generate String Value Objects for testing.

JavaScript Notes

Example 1: Create a String Value Object with value “hello”

var StringValueObject = Java.type("com.ergotech.vib.valueobjects.StringValueObject");
mySVO = new StringValueObject("hello");

Example 2: Trim the whitespace from a server named “Input” in the logic and make it all uppercase

var StringValueObject = Java.type("com.ergotech.vib.valueobjects.StringValueObject");
rawText = Input->getStringValue();
trimmedText = rawText.trim().toUpperCase();
newSVO = new StringValueObject(trimmedText);

Example 3: Create a SQL statement from several variables in the logic

machineID = MachineID -> getStringValue();
shiftNumber = Shift -> getLongValue();
SQL = "SELECT Downtime,ProductCount,ProductID from OOETable where Shift= " + shiftNumber + " and MachineID = '" + machineID +"'";

Note: a String Value Object will be automatically generated for a non-numeric output from the JavaScript. You do not need to explicitly create the StringValueObject. For example,this will add the incomingValue String to another String and the output is a String:

test = incomingValue.getStringValue();
test = test + " the End.";
test;
  • stringvalueobjects.txt
  • Last modified: 2021/10/12 11:41
  • by wikiadmin