Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
compare strings and perform action
#1
Solved: 11 Years, 3 Months, 4 Weeks ago Wink 
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:
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


Attached Files
.doc   screen.doc (Size: 97.5 KB / Downloads: 169)
Reply


Messages In This Thread
compare strings and perform action - by Forrest Gump - 09-03-2011, 07:16 PM
RE: compare strings and perform action - by Rohan - 09-06-2011, 11:55 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Compare WebTable Elements saraiado 1 2,559 06-11-2015, 06:54 PM
Last Post: venkatesh9032
  How to compare two binary values Naresh 0 2,349 09-09-2014, 05:06 PM
Last Post: Naresh
  Same command needs to be performed twice to actually perform it pistaa 2 2,923 04-25-2014, 01:26 PM
Last Post: pistaa
  Perform some functions whenever QTP Stop button is pressed smartkarthi 2 3,222 08-22-2013, 11:43 AM
Last Post: smartkarthi
  how to compare excel with datatatble diya 4 5,456 12-04-2012, 05:39 AM
Last Post: diya

Forum Jump:


Users browsing this thread: 2 Guest(s)