Jump to the post that solved this thread.
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Problem with Data Table
#1
Solved: 10 Years, 6 Months, 2 Weeks ago
I am just giving some user credentials in data table and executing the flight application

My Data Table look likes below..

Username Password
---------- ---------
aaaaa mercury
bbbbb testing
ccccc mercury

Actually the scenario is to check with each of the user credentials & verify whether the user credentials are correct or not.

Below is my code...

Code:
InvokeApplication "C:\Program Files (x86)\HP\QuickTest Professional\samples\flight\app\flight4a.exe"

CntDtData=DataTable.GetRowCount

For i=1 to CntDtData
    Username1=DataTable.Value("Username",i)
    Password1=DataTable("Password",i)
        Dialog("Login").WinEdit("Agent Name:").Set(Username1)
    Dialog("Login").WinEdit("Password:").Set(Password1)
    Dialog("Login").WinButton("OK").Click
    If Window("Flight Reservation").Exist Then
        Reporter.ReportEvent micPass,"Flight Reservation","Login Successful for user:"&Username1
        Window("Flight Reservation").Close
        InvokeApplication "C:\Program Files (x86)\HP\QuickTest Professional\samples\flight\app\flight4a.exe"
     else
           Reporter.ReportEvent micFail,"Flight Reservation","Login Unsuccessful for user:"&Username1
        Dialog("Login").Dialog("Flight Reservations").WinButton("OK").Click
    End If

Next
else
    Reporter.ReportEvent micFail,"Login Window","Login Window is not displayed"
End If

When I am executing the above code,I can able to verify the 1st user credential but after that I am geeting the run time error as 'Column Name Username does not exists'

Please find the attached screen shot regarding my error.


Attached Files Image(s)
   
Reply
#2
Solved: 10 Years, 6 Months, 2 Weeks ago
Hi,
You are getting this error because you are using i in place of sheetid. Since i is changing with every iteration, code is trying to fetch value from a column, in sheet i. You can omit using i and just give only the column name. The best way to do this is:

Code:
CntDtData=DataTable.GetRowCount
For i=1 to CntDtData
    DataTable.SetCurrentRow(i)
    Username1=DataTable.Value("Username")
    Password1=DataTable("Password")
........
........
.....
Next
Reply
#3
Solved: 10 Years, 6 Months, 2 Weeks ago
Thanks Sandeep.Its working fine..
Reply
Jump to the post that solved this thread.


Possibly Related Threads…
Thread Author Replies Views Last Post
  data table use uft_usr 1 2,115 06-29-2016, 05:23 PM
Last Post: Ankesh
  Writing to Run time data table Neetha 5 11,670 08-27-2015, 10:18 AM
Last Post: supputuri
  Retrieving data from web table nsuresh316 1 2,963 03-03-2014, 08:29 AM
Last Post: basanth27
  How to get data from data table in Ascending order dipashri 1 3,455 01-28-2014, 09:54 PM
Last Post: jacosta
  Data Table Query Suma Parimal 4 4,475 01-21-2014, 12:50 PM
Last Post: Suma Parimal

Forum Jump:


Users browsing this thread: 1 Guest(s)