toSafeArray Method
Converts a JavaScript Array object to a COM SafeArray.
Remarks
Some UFT utility methods, such as Record and Report, require SafeArray type arguments.
Syntax
JScript
public function toSafeArray(
inArray : Array
);
Parameters
inArray
A JavaScript Array.
Returns
A SafeArray with the elements of the input array in the same order.
Example
In the following example, an array is created, and then converted to a SafeArray.
var arr = new Array();
// Add objects to the array.
arr[0] = "item1";
arr[1] = "item2";
arr[4] = "item3";
// Return a COM array with the following items:
// { "item1", "item2", null, null, "item3" }
return toSafeArray(arr);
See also: