Select one value from the webtable and compare to the datatable
Below is a code that I am using to get the value from the webtable and compare to the values in the datatable in QTP, but the problem I am having is that I am not able figure how to skip the the duplicate value and stick with one value if its exist. For example:
Datatable in QTP
Marketing & Advertising-1
The above values are in the datatable and the application might have number of duplicate values such as Supp-1000, supp-2000,supp-3000. I want to verify the values that are in the datatable with the application in sort order. Thanks help is greatly appreciated
RowCount = Browser("View Application").Page("View Application_3").WebTable("Original-1").GetROProperty("rows")
For i = 1 To RowCount-1
Datatable("Sub_Type_Actual_Values",dtLocalSheet) = Browser("View Application").Page("View Application_3").WebTable("Original-1").GetCellData(i,1)
If Datatable.Value("Sub_Type_Expected_Values",dtLocal Sheet) <> Datatable.Value("Sub_Type_Actual_Values",dtLocalSh eet) Then
Datatable.Value("Sub_Type_Actual_Values",dtLocalSh eet) = ""
You could extract both the webtable and the datatable contents to seperate arrays (make the datatable array 2-dimensional and sort it)
Loop thru the webtable array, for each entry loop thru the datatable array and compare using regex & InStr. Where you get a match write the write the index of the webtable entry to the 2nd dimension of the match.
Once you have processed all the webtable entires your 2nd dimension values should be in ascending order if the webtable is sorted correctly.
Whatever Mark suggested can't be wrong and it works also
We can you Systems.Arrays.List Which will enable us to search an item quickly and sort an array quickly .Google for it
Tags for this Thread