Hi Lokesh,
First verify that weather your code get row cell data. ?
You can use print or msgbox keyword to verify..
Code should look like below.. I have used one for loop instead of
two..
rc = Browser("").Page("").WebTable("").GetROProperty("rows")
For rowFirst= 1 to rc-1
ADate =
trim(Browser("").Page("").WebTable("").GetCellData(rowFirst,colno))
BDate =
trim(Browser("").Page("").WebTable("").GetCellData(rowFirst+1,colno))
If Not cdate(ADate) <= cdate(BDate) then
Flag = 1
Exit For
End If
Next
if Flag = 1 then
result fail
else
result pass
end if
Thanks & Regards,
Jaimin Shah
On Jun 27, 10:00 am, lokesh vinu <[email protected]> wrote:
> 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]
> >> For more options, visit this group at
> >>http://groups.google.com/group/MercuryQTP?hl=en
>
>
>
> Dates.png
> 5KViewDownload
--
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