Hi Priyanka,
I have understand the problem.Here i am giving my resolution,If it works
well and good.
So,u have to select a row where the required customer namehas to over ride
with the new customer name.
1.Take the row count of the table.
2.Declare three variables to cature the customer name and to give the
customer name
Ex:Dim strCapturedCustomerName
Dim strNewCustomerName
Dim strNamesToModify
3.As per my understanding ,suppose if u want to modify 3 customers with new
customer names.
4.First you have to pass the Array for 3 newcustomer names where u have to
modify with newcustomer names
5.Pass the input values at QTP input parameters settings like below
*Name* *Type* *Values*
Ex:NewCustomerName String Sridhar;Kavya;Priyanka-----U have to
separate this values with delimeter as ";"
NamesToModify String Rajinikanth;Chiranjeevi;KamalHasan
6.Then u have to capture these valuse inside the script like below
strNewCustomerName=*Parameter*("NewCustomerName")
strNamesToModify =*Parameter*("NamesToModify")
strNewCustomerName=*Split*(strNewCustomerName,";",-1)--------'This split
function will create a Array,Read once about "Split" function
strNamesToModify=*Split*(strNamesToModify,";",-1)--------
strMaxIterations=*UBound*(strNewCustomerName)-----------This will give u
the maximum number of times u have to modify the cusotmername,suppose if u
want to modify 3 users the strMaxIterations will be the 3
7.Now i am modifying the code as per ur requirement
intRowCount=SwfWindow(““).SwfWindow(““).SwfTable(““).RowCount
intCounter=1
*For* *intCounter*=*1* *To* *strMaxIterations----*It will run 3 times
intIteration=*intCounter-1*
* For intRowCounter=1 To **intRowCount*-----------------One more For
loop to get the required value from table
strCapturedCustomerName= SwfWindow(““).SwfWindow(““).SwfTable(““).GetCellData(
*intRowCounter,"CustomerName")---I* am assuming that the column name is
"CustomerName"
If strCapturedCustomerName=strNamesToModify(intIteration)
SwfWindow(““).SwfWindow(““).SwfTable(““).SetCellData
strNewCustomerName(intIteration)
Exit For
End If
*Next*
*Next*
I hope that my resolution will give u an idea to fulfill ur requirement.
Let me know if u need any further calrification
Thanks
Sridhar
On 11/2/09, Priyanka <[email protected]> wrote:
>
>
> Hi Sridhar,
>
> Thanks for the reply!!
>
> Yes you’re right, I want to select the last row from the table. Let
> me try to explain more in detail:
>
> Condition:1 - I’ve asked QTP to generate “”Priyanka” as a new customer
> every time I run the script
>
> Condition:2 – Now, because there are couple of people working in the
> same module. Hence, whenever I’ll open my application and run the
> script to generate new customer “Priyanka”, it would not be added in
> the same row count everytime. It may be sometimes on 10th row and
> other time on 16th row.
>
> Condition:3 –I want QTP to click on “Priyanka” everytime and edit the
> same customer everytime.
>
> Solutions: There are 2 solution with best of my knowledge to handle
> this:
>
> 1. I ask QTP to search, select and click the value “Priyanka” – I do
> not know how is it possible?
> 2. I go by row count, as you mentioned – But I’m not able to run this.
> Getting the error “Input string was not in a correct format”.
> Wondering where in the script have we mentioned to click always on the
> last row.
>
> Hope my above points will provide you more details. It will be really
> great if you can put some more lights on it.
>
> Many Thanks in advance
>
> Priyanka
>
>
> On Nov 1, 3:19 am, b sridhar <[email protected]> wrote:
> > Hi Priyanka,
> >
> > As per my understanding you want to select the last row from a table.
> >
> > Here i am giving the code segment.If it works try this
> >
> > intRowCount=SwfWindow(““).SwfWindow(““).SwfTable(““).RowCount
> > intCounter=1
> >
> > For intCounter=1 To intRowCount
> > If intCounter=intRowCount
> > SwfWindow(““).SwfWindow(““).SwfTable(““).SelectRow
> > "intCounter----This is the last row number
> > Exit For
> > End If
> > Next
> >
> > Let me know ,If you want any further clarification.
> >
> > Thanks
> > Sridhar
> >
> > On 10/30/09, Priyanka <[email protected]> wrote:
> >
> >
> >
> > > I'm using QTP on window based application with.NET properties.
> >
> > > In my application whenever I add a "New customer name" it gets added
> > > at the end of the row.
> >
> > > Recording Mode: While recording I've generated the script to "Create
> > > new customer" and edit the same but QTP recording the whole script by
> > > row number.
> > > Below is the script for better understanding
> >
> > > SwfWindow("").SwfWindow("").SwfTable("").SelectRow "0"
> > > SwfWindow(““).SwfWindow(““).SwfTable(““).ExpandRow "0"
> > > SwfWindow(““).SwfWindow(““).SwfTable(““).ActivateRow "0;18"
> > > SwfWindow(““).SwfWindow(““).SwfTable(““).SelectRow "0;18"
> > > SwfWindow(““).SwfWindow(““).SwfTable(““).ExpandRow "0;18"
> > > SwfWindow(““).SwfWindow(““).SwfTable(““).ActivateRow "0;18;5"
> > > SwfWindow(““).SwfWindow(““).SwfTable(““).SelectRow "0;18;5"
> >
> > > Requirement for run mode:
> >
> > > I've set the data parameter to auto generate the new customer for each
> > > iteration. But my problem here is that after creating a new customer
> > > from data, QTP is always clicking on the same recorded row. Whereas I
> > > want QTP to click always on the last name of the row.
> >
> > > Can anyone help me to understand how can I set my script to click on
> > > the last value of the row. Few people have suggested me before to use
> > > regular expression but my requirement here is that QTP should not only
> > > recognized but it should also click and edit the last value in the
> > > row.
> >
> > > Please do not hesitate to ask again, if I am not very clear in my
> > > question .
> >
> > > Many thanks.
>
> >
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
"QTP - HP Quick Test Professional - Automated Software Testing"
group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/MercuryQTP?hl=en
-~----------~----~----~----~------~----~------~--~---