This section will cover basic of Javascript.


Object Description Sample
String Strings are useful for holding data that can be represented in text form.
'This is a string'
"This is still a string"
new String("This is not necessary")
Number All numbers in JavaScript, both integer or floating-point are of type Number.
new Number(100)
Array Arrays are list-like objects. Neither the length of a JavaScript array nor the types of its elements are fixed.
[]                  // Empty Array
[1,2,3]             // Array with three Number
['A', 1]            // Array with one String and one Number
new Array(1,2,3)    // Array with three Number
new Array(10)       // Array with 10 empty elements
Boolean The value passed as the first parameter is converted to a boolean value, if necessary. If value is omitted or is 0, -0, null, false, NaN, undefined, or the empty string (""), the object has an initial value of false.
new Boolean(false)
Function In JavaScript every function is actually a Function object.

var round = function(a,b){
    return Math.round(a+b);

var round = new Function("a","b", "return Math.round(a+b)")

var x = round(1.1, 2.5); // x is 4
Math Math is a built-in object that has properties and methods for mathematical constants and functions.
var x = Math.PI         // x is 3.141592653589793
var x = Math.ceil(10.1) // x is 11
Date Date instance that represents a single moment in time. Date objects are based on a time value that is the number of milliseconds since 1 January, 1970 UTC.
var today = new Date();
new Date("December 17, 1995 03:24:00");
new Date(1995,11,17,3,24,0);;
JSON JSON is a built-in object that has methods to serialize objects into string (JSON format) and deserialize JSON into objects.
var x = JSON.parse('{"a" : 1, "b" : 2}');
// x is an object with property a = 1 and property b = 2
var y = JSON.stringify(x);
// y is a string '{"a" : 1, "b" : 2}'

var (Variables)

Declares a variable, optionally initializing it to a value.

var x = 1;          // Assign one property
var y = 2, z = 3;   // Assign multiple property

var r = Math.round; // Assign to a function
var z = r(100.1);   // Z is 100



var rooms = $d.getRooms();
for(var i=0; i<rooms.length;i++){

Mathematical Operators

All Javascript mathematical operators are supported. Refer to W3 website for more details

Operator Description Sample
+ Combine integers or string

100 + 200 = 300

'String' + 200 = 'String200'

'String' + '2 Hundred' = 'String2Hundred'

- Subtraction 5 - 3 = 2
* Multiplication 5 * 3 = 15
/ Division 5 / 2 = 2.5
% Modulus (division remainder) 5 % 2 = 1
++ Increment 100++ = 101
-- Decrement 100-- = 99


Javascript Array Object. Refer to Mozilla Javascript Help

Member Description Sample
length Return the number of elements in an array. $d.getRooms().length
pop() Removes the last element from an array and returns that element.
push() Adds one or more elements to the end of an array and returns the new length of the array.
concat() Returns a new array comprised of this array joined with other array(s) and/or value(s).
every() Returns true if every element in this array satisfies the provided testing function.
forEach() Calls a function for each element in the array.
var windows = $d.getWindows();
var i = 1;
    window.set("Mark", i);
toList() Custom Implemented function to convert Array into a .NET List to be passed into a .NET method $d.getRooms().toList()


Member Description



Provide an alert message to the user

alert('This is an alert');



Provide a confirmation box to the user and returns true or false

confirm('Do you want to proceed?');

Window.prompt(text, value)

prompt(text, value)

Provide a dialog box to the user to provide an input value and returns the value

prompt('Please enter a value');
prompt('Please enter a value, 'DefaultValue');

Custom Implemented function to display an open file selection dialog

Window.openFile('Excel 2007|*.xlsx')

Custom Implemented function to display an save file selection dialog

Window.saveFile('Excel 2007|*.xlsx')
Window.selections(message, items, fn)

Custom Implemented function to display a selection dialog

var phases = $d.getPhases();
var selPhase = Window.selections('Select a Phase', phases, function(phase){
    return phase.Name;


The console object provides access to the debugging console. Not Implemented Yet

Outputting text to the console

The most frequently-used feature of the console is logging of text and other data. There are four categories of output you can generate, using the console.log(),, console.warn(), and console.error() methods. Each of these results in output that's styled differently in the log.