Forum Discussion
Here's an example,
function TableTest()
{
var table1 = ["a", "b", "c", "d", "e"];
var table2 = ["a", "b", "D", "f"];
for (var i = 0; i < table1.length; i++) {
for (var j = 0; j < table2.length; j++) {
if (aqString.Compare(table1[i], table2[j], true) == 0) {
Log.Message("Matched");
} else {
Log.Warning("No Match");
}
}
}
}I get the first item from table1, and compare it with each of the items in table2. I then get the second item from table1, and compare it with each of the items in table2. Etc.
The matched items will be "a" and "b".
rraghvani, Thanks for your example. I thought of doing the same but my issue is that at the end of the list comparision I want to know what all the values doesn't exists in table2. In your example on iteration one "a" matches, but "b" not matched and on iteration two "a" doesn't match but "b" matched. So that will not help me to make sure that only "a" and "b" matched but "c", "d", "e", "D", "f" doesn't match in both tables.
- tvklovesu3 years agoFrequent Contributor
I was able to resolve the issue by using Array.indexOf. That helped me to find if the table 2 contains the row value[i] from table 1.