09-03-2011, 07:16 PM
Hi All,
In run time, I want to compare strings in the datatable and perform action.
I have attached the screenshot with the code and datatable in the post.
Am also posting code here:
Aim: If Column "A" has value "ABC" then QTP must Enter Username and click cancel.
If column "A" has value "DEF" then QTP must enter password and click cancel.
But according to my code, it is entering Username if strings are same irrespective of data in Column "A".
Help me with the logic and also on coding if possible.
One of my application runs in similar logic so for better understanding I took Flight Application as example.
In my application, I have two Pages:
1. Change Organization (Enter Organization Name i.e column "A" values)
2. Enter values for organization
I will enter organization name (one orgnization name) once and then will enter its related data (this will be multiple records).
Then will again change Organization name and enter its records.
First column will have organization name; similar to the one I posted here i.e in Page1.
For Example: If Organization name is "ABC", then QTP must enter data related to column "ABC"
If value in Column "A" is changed from "ABC" to other value, say "DEF", then QTP must enter "DEF" in Organization name (i.e., Page1 in my application) and enter data related to column "DEF" (These data will be entered in Page2 of my application)
FYI: This action is no way related to my previous posts.
Thanks in advance
- Gump
In run time, I want to compare strings in the datatable and perform action.
I have attached the screenshot with the code and datatable in the post.
Am also posting code here:
Code:
Invokeapplication ("E:\Mercury Interactive\QuickTest Professional\samples\flight\app\flight4a.exe")
Dim a, b
row=DataTable.GetCurrentRow
a=datatable("A", dtGlobalSheet)
DataTable.SetCurrentRow(row+1)
b=datatable("A", dtGlobalSheet)
If strcomp(a,b)=0 Then
Dialog("Login").Activate
Dialog("Login").WinEdit("Agent Name:").Set "Forrest"
Dialog("Login").WinButton("Cancel").Click
Else
Dialog("Login").Activate
Dialog("Login").WinEdit("Password:").SetSecure "4e6224718ae0eaf92a4e26655f509650a67f9999"
Dialog("Login").WinButton("Cancel").Click
End If
Aim: If Column "A" has value "ABC" then QTP must Enter Username and click cancel.
If column "A" has value "DEF" then QTP must enter password and click cancel.
But according to my code, it is entering Username if strings are same irrespective of data in Column "A".
Help me with the logic and also on coding if possible.
One of my application runs in similar logic so for better understanding I took Flight Application as example.
In my application, I have two Pages:
1. Change Organization (Enter Organization Name i.e column "A" values)
2. Enter values for organization
I will enter organization name (one orgnization name) once and then will enter its related data (this will be multiple records).
Then will again change Organization name and enter its records.
First column will have organization name; similar to the one I posted here i.e in Page1.
For Example: If Organization name is "ABC", then QTP must enter data related to column "ABC"
If value in Column "A" is changed from "ABC" to other value, say "DEF", then QTP must enter "DEF" in Organization name (i.e., Page1 in my application) and enter data related to column "DEF" (These data will be entered in Page2 of my application)
FYI: This action is no way related to my previous posts.
Thanks in advance
- Gump