Friday, July 6, 2007

search for particular field in the table and to get the value in return

''Name : fnGetSearchData(objTable,intColumnCell,strSearchValue)
''Description: This function is used to search for particular field in the table and to get the value in return,
''for example on passing as "Primary:" it returns value like "abcd * efg", If that search value is not present
''then it returns "false" message
''Arguments: : Table object from where field name need to be searched
'' : columns cell away from the Searched string
'' : String need to be searched
''Example:
'' Set objTable=Browser("testing").Page("testing").Frame("WorkFlowFrame").WebTable("Primary:")
'' intColumnCell=1
'' strSearchValue="Primary:"
''Return Result Value/False
'Pre-Condition: NIL(Common)
'Post-Condition:NIL(Common)
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Public function fnGetSearchData(objTable,intColumnCell,strSearchValue)
On Error Resume Next
fnGetSearchData=false

'---------------Variable declaration-----------------------
Dim intRowCount
Dim intColumnCount
Dim strScreenValue
Dim intRowLoop
Dim intColLoop
'---------------Variable declaration-----------------------

Set objFrame=objTable
Set objPage=Browser("Chordiant").Page("Chordiant")
Call fnSynchroniseObjects(objPage,objFrame,20)
Browser("Chordiant").Page("Chordiant").sync


If IsObject(objTable) and objTable.Exist Then' Verify the Table object passed is an object and it exist or not
intRowCount=objTable.RowCount ' Gets the table row count

If not intRowCount ="" Then'Verify if the table row count is null or not

For intRowLoop=1 to intRowCount 'Loop navigates till row count ends

intColumnCount=objTable.ColumnCount(intRowLoop)' Get s the Table column count
For intColLoop =1 to intColumnCount' Loop navigates till column count ends

strScreenValue=objTable.GetCellData (intRowLoop,intColLoop)'Get the corresponding value from screen
If strcomp(trim(strScreenValue),trim(strSearchValue),1)=0 Then' compares the value from screen with value passed
intColumnCell=int(intColLoop+int(intColumnCell))
fnGetSearchData=objTable.GetCellData (intRowLoop,intColumnCell)' returns the value in function return value
Exit For ' After identifying the cell value it comes out of the loop
exit function
End If

Next

Next

End If
End If

End Function

No comments: