IR Framework

Array.eq Method

Compares two arrays for equality.
object.eq (arr)

Arguments

object
Required. Always the name of an Array object.


arr
Required. Array to compare.



Return Value

The Array.eq method returns the following values:
If Array.eq returns
arr is not an Array, arr.length != object.length, or any of the values contained in arr don't match the values of the elements with the same index in object false
the arrays appear to be equal true

Remarks

The Array.eq method currently handles the comparison of arrays containing objects of types Number, String, Boolean, or Array. Comparing arrays containing other types of objects will usually return false. An attempt to convert between string, number, and boolean types is made before comparison. See below for an example.
The following example illustrates the use of the Array.eq method.

//	Compare the selected values to the values represented 
//	in the displayed information
arrSelectedValues["Region"] = drpRegion.Item(drpRegion.SelectedIndex);
arrSelectedValues["Bien"] = drpBien.Item(drpBien.SelectedIndex);
if (!arrQueriedValues.eq(arrSelectedValues)) {
	//	do something
	...
	...
	ActiveDocument.Sections["Q-MyQuery"].Process();
	//	now that we've re-run the query(ies) or refreshed 
	//	the pivot(s), update the array to indicate that
	arrQueriedValues["Region"] = drpRegion.Item(drpRegion.SelectedIndex);
	arrQueriedValues["Bien"] = drpBien.Item(drpBien.SelectedIndex);
}
else {
	//	input matches currently displayed information
	//	so don't process the queries or refresh the pivots
}



//	This example demonstrates the ability to compare arrays of arrays 
//	and the data type conversion inherent in the comparison routine
var A = new Array(1, 2, new Array(4, "5", 6));
var B = new Array(1, 2, new Array(4, 5, 6));
Alert(A.eq(B));		//	returns true


Requirements