Skip to content

QTP using SelectCell on a SwfTable

New Discussion
Sarah
Sarah asked on Nov 29, 2012 9:52 PM

I ‘m running code to find two values in a swfTable.

the for loop code is the same except the first gets the row count, the second gets the column count.

my code successfully finds and expands row “i”, however it struggles with finding “m”

RVal = “YYY”
RC = SwfWindow(“window”).SwfTable “Grid”).RowCount
For i =0 to RC -1
RCVal = SwfWindow(“window”).SwfTable(“Grid”).GetCellData(i,1)
If RVal = RCVal Then
DataTable(“i”, dtGlobalSheet) = i
Exit For
End If
Next
SwfWindow(“window”).SwfTable(“Grid”).SelectCell DataTable(“i”, dtGlobalSheet),”viewindex”

CVal = DataTable(“XXX”, dtGlobalSheet)
CC = SwfWindow(“window”).SwfTable(“Grid”).ColumnCount
For m = 0 to CC -1
CCVal = SwfWindow(“window”).SwfTable(“Grid”).GetCellData(i, m)
If CCVal = CVal Then
DataTable(“m”, DtGlobalSheet) = m
Exit For
End If
Next
SwfWindow(“window”).SwfTable(“Grid”).SelectCell “i;m”, “dbvalue”

 

Sign In to post a reply

Replies

  • 0
    Michael Germann
    Michael Germann answered on Aug 19, 2010 5:24 PM

    Hi,

        This was a bit hard to follow, I recommend using a little more descriptive variable names in the future. That being said, in looking at it, when you first use the variable "m" you are using it as the index of the current column. But when you call SelectCell on the last line you are using it as part of the row arg instead of the column arg. SelectCell has two arguments, objRow, objColumn. objRow can be either a numeric or a string. If objRow is a numeric it represents the index of a row on the root band. If objRow is a string, it's a little more complex, but mostly it represents bands and rows, but you are passing in an index of a column, since it's a number, sometimes it may return a valid value, but on a whole it will likely not work as expected.

         I am guessing you are looking to SelectCell i, m, but I am not sure what the value "dbvalue" represents, is that supposed to be the column key, or are you trying to set it to the value "dbvalue", in which case I think you want to use SetCellData.

        As to how to use the objRow as a string. It is typically used only for hierarchical grids, in which case its a semi-colon separated list of row numbers, starting from the first number being the row on the root band, then continues down that row's child band row number on, repeating on down until it gets to the actual row. It adds a little bit more complexity in that you can have sibling child bands, so that an individual row can have multiple separate bands directly under it, in which case that section of semi-colon separated values is also comma separated, with the first number being the child band index, and the second number being the row number.

        That being said when you used SelectCell "i;m", "dbvalue" it translated it as Select the cell of root band row index i's child row index m with a column key of "dbvalue". Which can in theory exist, but will likely fail.

         I hope this helps,

     

    • 0
      thomas kirk
      thomas kirk answered on Nov 29, 2012 5:54 PM

      I also have a question about SelectCell.

       

      Why does this work:

      SwfWindow("RedPrairie E²e™").SwfTable("gridMst").SetView ""
      SwfWindow("RedPrairie E²e™").SwfTable("gridMst").SelectCell 0,0

       

       

      and this not:
      SwfWindow("swfname:=frmDLx").SwfTable("swfname:=gridMst").SetView ""
      SwfWindow("swfname:=frmDLx").SwfTable("swfname:=gridMst").SelectCell 0,0

       

      Both the SetViews work just fine, but the second SelectCell gives the error "The parameter is incorrect."

       

       

      • 0
        Michael Germann
        Michael Germann answered on Nov 29, 2012 9:52 PM

        SetView is an action for the XtraGrid, which is a DevExpress grid. As this is an Infragistics site, we won't have the best information on the subject. I would recommend contacting HP as they created the support for the XtraGrid. 

  • You must be logged in to reply to this topic.
Discussion created by
Favorites
Replies
Created On
Last Post
Discussion created by
Sarah
Favorites
0
Replies
3
Created On
Nov 29, 2012
Last Post
13 years, 8 months ago

Suggested Discussions

Created by

Created on

Nov 29, 2012 9:52 PM

Last activity on

Feb 12, 2026 9:20 AM