Terrasoft CRM 3.0 SDK > Examples > Files > IValueExample.js
ContentsIndex
IValueExample.js

 

Description
Body Source
//-----------------------------------------------------------------------------
// IValueExample.js file
//-----------------------------------------------------------------------------
// There is described the usage of the IValue object in the example. 
//-----------------------------------------------------------------------------
//@ Start Example

// Message displaying function 
function ShowMessage(Str) {
    for (var i = 1; i < arguments.length; i++ ) {
        Str = Str.replace(new RegExp('%' + i), arguments[i]);
    }
    WScript.Echo(Str);
}

// Creating the instances of the Value class
var Value1 = new ActiveXObject('TSObjectLibrary.Value');
var Value2 = new ActiveXObject('TSObjectLibrary.Value');
var Value3 = new ActiveXObject('TSObjectLibrary.Value');

// The function changing the IValue object data
function GetSomeValue(Value1, Value2, Value3) {
	// Assignment of the simple types values
	Value1.Value = 10;
	Value2.Value = "Year";

	// Assingment of the object in the value attribute
	Value3.Value = new Array(1, 2, 3);
}
// Calling the function GetSomeValue
GetSomeValue(Value1, Value2, Value3);

// Variable declaration for dispalying the data about the object instances
var MessageString; 

// Displaying the information about the first IValue object instance  
MessageString = "The value, which is stored in the first instance of the IValue object: " +
  Value1.Value;
ShowMessage(MessageString);

// Displaying the information about the second IValue object instance 
MessageString = "The value, which is stored in the second instance of the IValue object: " +
  Value2.Value;

ShowMessage(MessageString);

// Displaying the information about the third IValue object instance 
MessageString = "Values of the items, which are stored in the third instance " +
  "IValue object: " + Value3.Value.toString();
ShowMessage(MessageString);

//@ End Example
Copyright (с) Terrasoft 2002-2007.