Try OpenEdge Now
skip to main content
Application Developer's Guide
Developing an application : Using JavaScript in a workstep : Integrating JavaScript : Using new datatypes in JavaScript
 
Using new datatypes in JavaScript
The following examples show the use of new datatypes in JavaScript.

Using DateTimeTZ in JavaScript

var jdt = (new java.util.Date()).getTime();
var currentTime = new
Packages.com.savvion.sbm.bizlogic.server.svo.DateTime.getInstance(jdt);
jst.putDataSlot("dsDate", currentTime);
var date = jst.getDataSlotValue("dsDate");
jst.writeLog("Date value <"+date.getStringValue()+">");

Using decimal value in JavaScript

To set decimal values, use the setScale (int scale, int roundingMode).
var jdec = new java.math.BigDecimal(2222.555);
var bigdec = new
Packages.com.savvion.sbm.bizlogic.server.svo.Decimal.getInstance(
jdec.setScale(5, java.math.BigDecimal.ROUND_UP));
jst.putDataSlot("dsDecimal", bigdec);
var decimal = jst.getDataSlotValue("dsDecimal");
jst.writeLog("Decimal value <"+decimal.getStringValue()+">");

Using decimal in precondition JavaScript

js:function checkDecimal() {
var decimal = jst.getDataSlotValue("dsDecimal");
if (decimal.getValue().doubleValue() > 10.8) {
return true;
}return false;
} checkDecimal()