Forum Discussion

rramkis's avatar
rramkis
New Contributor
10 years ago

need to retrieve a row number where expected values find

I have a one table. in the table I want to retrieve a some expected values let assume that A,B,C these three I want to find . once its found I want to retrieve row number of each one.. the row number should be same for all the three because scenario we have to search in same row

sub retrivecolumnvalues(obj,columnvalue,ColumnValue)

rowcount = obj.wRowCount

columncount = obj.wColumnCount

msgbox rowcount

msgbox columncount

For i = 0 to rowCount

If GridObj.wValue(i, ColumnName) = (ColumnValue) Then

GridObj.ClickCell i,0

 

End If

end sub

4 Replies

  • baxatob's avatar
    baxatob
    Community Hero

    What is the type of your table? 

    Different types require different approaches.

    Did you receive an error using your code?

    Please provide more details about your problem.

     

    Have you read this topic >> ?

    • rramkis's avatar
      rramkis
      New Contributor

      Function retriveRnumber(GridObj,expected1,expected2) 
       resultfound = false
       totalrows = GridObj.wRowCount
       totalcolumns = GridObj.wColumnCount
       for i = 0 to totalrows-1
        for j = 0 to totalcolumns-1
        val1 =  GridObj.wValue(i, j) 
          'if  val1 = obj.cells(i,j).value
              if val1 = expected1 then
                for k = j to totalcolumns
                  val2 = GridObj.wValue(i, k) 
                    if val2 = expected2 then
                      exit for
                    else 
                      log.Error "not as expected"
                    end if
                  next
                end if
                if val1 = expected1 and val2 = expected2 then 
                    resultfound = true 
                else
                    log.Error "result not found"
                end if
            next
        next
       End Function
            

       

       

       

      its devexpress table

      • Colin_McCrae's avatar
        Colin_McCrae
        Community Hero

        What language is the application developed in? And what is the classname of the DevExpress grid. They do more than one kind. The link baxatob posted contains links to how you work with a couple of DevExpress grid specifically.

  • NisHera's avatar
    NisHera
    Valued Contributor

    This is kinda psudo code for your problem 

    Looks more like jscript

    have to rewite in vbs and get values using correct grid methods

    For (i =0 to RowCount){
        var AExist = false
        var BExist = false
        var CExist = false
        For (j = 0 to columncount){
    	     P = grid.wvalue(i,j)
    	     if (p == A)
    		   {AExist = true}
    	     if (P == B)
    		   {BExist = true}
                 if (P == C)			
    		   {CExist = true }}
        If (AExist and BExist and CExist)	 
    	  {Log. message ("A B C Exists in the row number "+ i) }}