Try using the .net code for this..which is a easy way.but .net framework
needs to be installed on your PC to run the below code

 

Set ObjDate = CreateObject("System.Collections.ArrayList")

 

'add getcelldata to this object

ObjDate.Add output

ObjDate.Add output

 

ObjDate.Sort() ' after sorting compare both the lists...

 

Set ObjDate = Nothing

 

Sreedhar Mallipeddi

Audubon Village,

5830 Memorial Highway,

Tampa, FL - 33615

Mobile: 813-334-0327

Home: 214-257-0599

 

From: [email protected] [mailto:[email protected]] On
Behalf Of lokesh vinu
Sent: Monday, June 27, 2011 1:01 AM
To: [email protected]
Subject: Re: Validation of Sorting a Web-table

 


Hi All,

I need to validate the sorting order  of these day. which is in a Webtable I
tried using for loop as mentioned below but it doesnt workout, Please
provide any solution for the same.

rc = Browser("").Page("").WebTable("").GetROProperty("rows")

    For rowFirst= 1 to rc
        For rowSecond = 2 to rc
            ADate =
Browser("").Page("").WebTable("").GetCellData(rowFirst,colno)
            BDate =
Browser("").Page("").WebTable("").GetCellData(rowSecond,colno)

        If ADate < BDate then
              Reporter.ReportEvent micPass, "Validation","The dates are
sorted correctly"
          ElseIf BDate = ADate then
                 Reporter.ReportEvent micPass, "Validation","The dates are
sorted correctly"
          ElseIf BDate > ADate then
                Reporter.ReportEvent micFail,"Validation","The dates are NOT
sorted correctly"
            Else
                Reporter.ReportEvent micWarning, "Validation","The dates are
NOT sorted correctly"
            End If
            If rowSecond = rc then
                Exit For
            End If
        Next
    Next


 

Thanks! in Advance for the help.

Lokesh K

On Thu, Jun 23, 2011 at 9:38 AM, lokesh vinu <[email protected]> wrote:

Hi Jaimin,

Thanks for your reply.

When I try running your code I'm getting type mismatch error in the line (
If  NOT cdate(dtmCurrRow) <=  cdate(dtmNextRow) Then)
any suggestion how to overcome this.

Lokesh

 

On Wed, Jun 22, 2011 at 5:32 PM, jaimin <[email protected]> wrote:

Updated code..


 For i =1 to TableRowcount -1

 dtmCurrRow  = TableObject.GetcellData(i,<Column>)
 dtmNextRow  =  = TableObject.GetcellData(i+1,<Column>)
      If  NOT cdate(dtmCurrRow) <=  cdate(dtmNextRow) Then

              Flage = 1
              Exit For
      End If
End

If Flage <> 1 than
 Result Pass
Else
 Result Fail
End if

Let me know if you have query..

Thanks



On Jun 22, 4:53 pm, jaimin <[email protected]> wrote:
> 1. Click on Date column which sort the date in ascending order.
> 2. Get first row and second row date value form Date column
> 3. Check first row date should be less than or equal to second row
> date.
> 4. Get second row and third row date value.
> 5. Check second row date should be less than or equal to third row
> date value.
> 6. Same way check untill end of row using For Loop.
> 7. In the case if you got false result while comparison two row you
> need to break the for loop and show the fail result......
>
>  For i =1 to TableRowcount -1
>   GET CurrRow  = TableObject.GetcellData(i,<Column>)
>   GET NextRow  =  = TableObject.GetcellData(i+1,<Column>)
> If  cstr(sCompareVal) >  cstr(sNextCompareVal) Then
>                 sFlage = 1
>                 Exit For
>         End If
>
>   End
>
> Thanks & Regards,
> Jaimin Shah.
>
> On Jun 22, 3:35 pm, lokesh vinu <[email protected]> wrote:
>
>
>
>
>
>
>
> > Hi All,
>
> > I'm trying to validate the sorting order of in webtable.I need to verify
the
> > column, is sorted in descending order.
> > Have anyone faced similar kind of scenario. Please let me know how to
work
> > on this.
> > Note: The columns fields are DATE
> > Thanks in advance.
>
> > Lokesh K

--
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]
<mailto:mercuryqtp%[email protected]> 
For more options, visit this group at
http://groups.google.com/group/MercuryQTP?hl=en

 

 

-- 
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

  _____  

No virus found in this message.
Checked by AVG - www.avg.com
Version: 10.0.1388 / Virus Database: 1513/3728 - Release Date: 06/26/11

-- 
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

Reply via email to