how to compare data in two table variables
Hello,
I have created two variables of table type and add data in both the tables. I want to check if the data from table 1 in table 2 and not sure how to get that done. Below is the snap shot of my script
Table one
var tab = ProjectSuite.Variables.VariableByName("htsCodes")
resCounts = 3
for (i = 0; i <resCounts; i++){
var j = i+1
var codeValue = Aliases.Page.discrpcy_results_Table.FindElement("./tbody/tr[" + j + "]/td["+columnValue+"]").textContent
tab.$set("htsCodes", i, codeValue)
}
Table Two
var tab = ProjectSuite.Variables.VariableByName("htsCodesinDescription")
resCounts = 5
for (i = 0; i <resCounts; i++){
var j = i+1
var codeValue = Aliases.Page.results_Table.FindElement("./tbody/tr[" + j + "]/td["+columnValue+"]").textContent
tab.$set("htsCodesinDescription", i, codeValue)
}
now I want to check if Table two[i] value exists in Table one
Something like
table1=["11","12", "13"]
table2 = ["11,"12", "13","14","15"]
Compare
var table2 = ProjectSuite.Variables.VariableByName("htsCodesinDescription")
var table1 = ProjectSuite.Variables.VariableByName("htsCodes")
for (i=0; i<=table2.RowCount; i++){
value = tab.$get("htsCodesinDescription", i)
if (table1.contains(value)){ //for me it says table1.contains is not a function
pass
}
else{
fail
}
}