| || |
Comparing 2 arrays
I would like to compare 2 arrays using j script.
I am getting data from 2 different tabs in an app and compare.
First tab page - I need to get 5 columns from an infragistics grid
Second tab page also I need to get 5 columns(grid) but column names are different and data needs to be sorted by column 1 in order to compare.
For the first tab page...
var p_abc = Aliases.Sys.Process_abc.Win_abc
// Tabpage 1Grid
var GridTab1 = p_abc.wfo_AVSplitterPanel.wfo_splitContainer.av_Sp litterPanel.abc_tabpage1
for (i=1;i<GridTab1.wRowCount ;i++)
// Getting the items for comparison from the Tab1
//Log.Message(GGridTab1.wValue(i, "Element Name"));
ArrayObjectA_Obj= GridTab1.wValue(i, "Element Name");
ArrayObjectA_Obj = GridTab1.wValue(i, "Composition ");
ArrayObjectA_Obj = GridTab1.wValue(i, " Ht ");
ArrayObjectA_Obj = GridTab1.wValue(i, "amount");
ArrayObjectA_Obj = GridTab1.wValue(i, "wt");
for (var j in ArrayObjectA_Obj)
I get the values from the array but I want to store them so that I can compare the values from 2 arrays.
The way I'm doing it its overwriting the data . Please tell me the best way to store this data in an array and compare this data with another grid data.
1. Get data from tabpage 1
2. Get data from tabpage2 sort it
3. Compare data from tabpage1 with tabpage2.
Any help will be greatly appreciated.
A sample will greatly help.
Re: Comparing 2 arrays
Create another array and use one more loop to store values from tabpage 2. Then, write a loop which will iterate through one of your arrays, get values from it one by one, get values from another array one by one and compare them.