Access a table row based on columns value

I have some information in table. for example
Table table has four columns.
It has two rows with following values in each columns

col1 col2 col3 col4

val val12 val13 link1
val21 val22 val23 link2

I have a value stored in the data table as an out put value lets say val21 from an earlier page

Once I am on this page I want to compare this value to the tables columns values. If I find a match I want to click the corresponding link in that row. The problem is the rows are displayed randomly thats why I cannot hardcode the row value. first I want to find the row which has this value and click the link in the fourth coulm of that row.

please help. Please let me know If you need more clarification on the problem

Questions by fullmoon74   answers by fullmoon74

Showing Answers 1 - 2 of 2 Answers

There are two Approach for the same.

1. Object Repository

  ''Suppose the Table is captured in OR

   For intCnt = 0 to Browser().Page().Frame().WebTable(Tbl).GetROProperty("row count")
         strVal = Browser().Page().Frame().WebTable(Tbl).GetCellData(1, intCnt+1)
         if strComp(strVal, DataTable.Value("Value", dtLocalSheet)) = 0 then
             ''Please check for the click method :(
         end if
   Next

2. Descriptive Programming

   '''Description of the First Column Element

    Set oVal= Description.Create()
    Set oVal("micclass").Value = "<<Class of the Column Element>>"
    Set oVal("html id").Value = "<<html id of the Column element>>"

    Set TBL_ELEM = Browser().Page().Frame().ChildObjects(oVal)
    
    '''Description of the Link in the Table

    Set oLink = Description.Create()
    Set oLink ("micclass").Value = "<<Class of the Link Element>>"
    Set oLink ("html id").Value = "<<html id of the Link Element>>"

    Set TBL_LINK = Browser().Page().Frame().ChildObjects(oLink)
''''There is an Assumpation that the Link and the Val Element are analogous :)
  strLocVal = Datatable.Value("Value",dtlocalsheet)
  For intCnt = 0 to TBL_ELEM.Count-1
     if strComp(Trim(TBL_ELEM(intCnt).GetROProperty("innertext")),strLocVal  ) = 0 then
     
         TBL_LINK(intCnt).Click
     end if
  Next

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions