Quality Testing

Quality is delighting customers


Suppose we have data table with column name city and there we have names of all cities.Now my scenario is how to identify particular city(Ex.Bangalore) among them?How o check that how many times a country name has been repeated i,e for duplicatest?Using VB Script in QTP 10.0.

Thanks in Advance.


Views: 369

Reply to This

Replies to This Discussion

use .childitem(row,col,"mic class",index)

Hi Sahoo,

Thanks for u r reply.But i asked for data table not for web table.could u plz check once and clarify.

Traverse the webtable and fetch the cell data. If specific data found then increase the counter otherwise use childItem as mentioned by sahoo.

Hi Ganesh,

first initialize flag val to zero . By Using GetRowwithcellText Method we can get city whr exact it is located in a table, then after increment flag value +1 then u r will get count finally Print flag count...

plz correct me if i am rong



Dear Ganesh,

Please see the below code for your purpose

if wrong let me know the correct information

City=Inputbox("Enter city for found in datatable")

RC=Datatable.GetSheet(2).GetRowCount  'getting data from Action1 Sheet

For i=1 to RC
If Dtcity=City Then
End If
If c>0 Then
print "City Existed:"&city
print "Existed Times:"&c
End If

Hi Sudheer,

Thanks for u r reply.It is working fine.But i have one small doubt in the above code if instead of If Dtcity=City Then i used if strcomp(Dtcity,City,0) Then or  if strcomp(Dtcity,City,1) Then.. it is giving wrong result could u plz clarify once....

Thanks in Advance...

if strcomp(Dtcity,City,0) does binary comparison and if strcomp(Dtcity,City,1) does textual comparison. Try to use LCASE or UCASE with them.

ok Mohit. 


        for i=1 to irows


        msgbox datatable("city",dtglobalsheet)

     if datatable("city",dtglobalsheet) <>"" then

        print "city :" &city

        end if


Thank u reddy..


TTWT Magazine





© 2020   Created by Quality Testing.   Powered by

Badges  |  Report an Issue  |  Terms of Service