The previous articles written for the Siebel category were written from a perspective of version 7.7 and 7.8. I know of many of you have already have upgrades Siebel to 8.1, and so have we! This gave me a chance to update my old article on the SiebList object. Not much has changed, actually, but the code here has been optimized for better performance and compatibility with the latest version. Information regarding its limitations has also been included.
Instead of using the code from this article directly in your libraries, please use the download link instead, as the download files include documentation.
The techniques in this article have been tested on QTP 9.5 and Siebel 8.1. I do not guarantee that the techniques will be supported in older versions of Siebel, but if they aren’t, I believe with a few minor tweaks, they should become workable.
Limitations
- As present, descriptive programming is not the recommended technique for automating a Siebel List. This is a limitation which is caused by the CAS API which exposes the object during replay as a SiebList, although in record some internal objects are exposed. Therefore the spy and highlight will show us the SiebList, and also the child object will return 0, since only the table is exposed1.
- Any column not visible on the screen will not be accessed by QTP. This includes the column that are brought into picture using the horizontal scroll-bar.
- There are certain operations that do not perform well, and my personal recommendation would be to explore if usage of native methods are possible on the target objects.
- Document ID KM204700 in HP’s KB lists a limitation which states a limitation in accessing cell items of a SiebList.
Find the Total Number of Records (Rows) in a SiebList
In the previous version of this article, the only possible way demonstrated to retrieve the row count from a Siebel List was through the RecordCounter. However, there is another (faster) way which is through the use of the shortcut keys to retrieve the number of rows. The shortcut keys that can be used to retrieve the total rows are: CTRL+SHIFT+3.
Record Count ShortCut
When using the shortcut, a will appear containing the record count:
Record Count
The following function shows the entire process of using the shortcut keys and retrieving the count from the window above:
Using Short-Cut Keys: CTRL+SHIFT+3
'-------------------------------------------------------- ' Name: Function GetSiebListRecords ' ' Remarks: N/A ' ' Purpose: Retrieve the number of records (rows) from a Siebel List ' using short-cut keys ctrl+shift+3 ' ' Arguments: ' sBrowserTitle: Title of the Siebel Browser ' ' Return: Integer ' ' Author: Anshoo Arora, Relevant Codes ' ' Date: 03/17/2010 ' ' References: N/A '-------------------------------------------------------- Function GetSiebListRecords(sBrowserTitle) Dim oWScript, oRegExp, oMatches, sText GetSiebListRecords = -1 Window("hwnd:=" & Browser("title:=" & sBrowserTitle).Object.HWND).Activate Set oWScript = CreateObject("WScript.Shell") oWScript.SendKeys "^+3" With Browser("opentitle:=SiebWebPopupWindow") While Not .Exist(0) Wait(2) Wend sText = .WebElement("innertext:=.*records.*", "index:=1").GetROProperty("innertext") Window("hwnd:=" & .Object.HWND).Close End With Set oRegExp = New RegExp oRegExp.Global = False oRegExp.Pattern = "\d+" Set oMatches = oRegExp.Execute(sText) If oMatches.Count > 0 Then GetSiebListRecords = CInt(oMatches(0)) Set oWScript = Nothing Set oRegExp = Nothing Set oMatches = Nothing End Function
Download: GetSiebListRecords Using ShortCut (168)
When there are many rows present in SiebList, it may not show the exact number. Instead it shows 1-10+ rows, 11-20+ rows, 21-30+ rows and so on. To get the correct number of rows from the List object, we use an the RecordCounter property of SiebApplet. RecordCounter indicates the visible text of the record counter string (for example: 1-10 or 10+). This is also the traditional (and slower) approach.
Traditional Method: RecordCounter
'-------------------------------------------------------- ' Name: Function GetSiebListRecords ' ' Remarks: N/A ' ' Purpose: Retrieve the number of records (rows) from a Siebel List ' using RecordCounter ' ' Arguments: ' oSiebApplet: Reference to the SiebApplet Hierarchy ' sUINameSiebList: UIName of SiebList ' ' Return: Integer ' ' Author: Anshoo Arora, Relevant Codes ' ' Date: 03/17/2010 ' ' References: N/A '-------------------------------------------------------- Function GetSiebListRecords(oSiebApplet, sUINameSiebList) Dim iCnt If InStr(1, sUINameSiebList, "uiname") <> 0 Then sUINameSiebList = Trim(Split(sUINameSiebList, ":=")(1)) End If iCnt = oSiebApplet.RecordCounter Do If Not InStr(1, iCnt, "+") <> 0 Then Exit Do Else oSiebApplet.SiebList("uiname:=" & sUINameSiebList).NextRowSet iCnt = oSiebApplet.RecordCounter End If Loop If InStr(1, iCnt, "of") <> 0 Then iCnt = CInt(Trim(Split(iCnt, "of")(1))) End If GetSiebListRecords = iCnt End Function
Download: GetSiebListRecords Using RecordCounter (147)
Find a text string in the SiebList’s column
If the requirement is to find some text in one of the columns of the SiebList, we can loop over all the rows until we find the value that we’re looking for. Note that the column name may be different as it appears to the human eye. You will have to find the correct column name for this to work correctly. For example, in our environment, we have a column named Application Number. However, Application Number is what appears to us, but in reality, QuickTest identifies that column by Application ID.
'-------------------------------------------------------- ' Name: Function FindSiebListRow ' ' Remarks: N/A ' ' Purpose: Find the Row from the provided Column (sColumnName) where ' the given String (sText) exists. ' ' Arguments: ' oSiebApplet: Reference to the SiebApplet Hierarchy ' sUINameSiebList: UIName of SiebList ' sBrowserTitle: Title of the Siebel Browser ' sColumnName: Name of the SiebList Column ' sText: String to be searched ' ' Return: Integer ' ' Dependencies: Function GetSiebListRecords() ' ' Author: Anshoo Arora, Relevant Codes ' ' Date: 03/17/2010 ' ' References: N/A '-------------------------------------------------------- Function FindSiebListRow(oSiebApplet, sUINameSiebList, sBrowserTitle, sColumnName, sText) Dim iRows, iRow, sData If InStr(1, sUINameSiebList, "uiname") <> 0 Then sUINameSiebList = Trim(Split(sUINameSiebList, ":=")(1)) End If 'DEPENDANCY: GetSiebListRecords iRows = GetSiebListRecords(sBrowserTitle) With oSiebApplet.SiebList("uiname:=" & sUINameSiebList) .FirstRowSet For iRow = 0 to iRows - 1 .ActivateRow iRow sData = Trim(.GetCellText(sColumnName, iRow)) If CStr(sData) = CStr(sText) Then FindSiebListRow = iRow Exit Function End If Next End With End Function
{ 8 comments… read them below or add one }
Hi Anshoo,
Is there any way to verify that a column in SiebList is sorted by Alphabetical Order by default?
That is while navigating to a Tab in the page, there is a SiebList in the tab and a column in the SiebList lists the names in Alphabetical Order. For this, we should not sort the column and verify.
Is there any way to verify this?
Thanks in Advance,
HarisH
Hi
Who do i select a value from the list?
There is a method by name drilldown wherein i need to send the respository name.
Is there a method to select a value from the list without using repository name and in a descriptive programming.
@askviz: Yes, you can use either the ‘Repository Name’ or ‘UIName’ in your DP code to reference the SiebList but selecting a value may not be possible. As I mentioned in the Limitations section of this object:
http://siebeltipsntricks.blogspot.com is a best siebel blog
Sangeetha: Thanks for sharing this wonderful link.
The blog is removed .:-(
Hi Anshoo,
Thanks for sharing the valuable information.
QTP is throwing a run error “System error. Debug info: Failed to execute method id 23 with args ((7)). Reason: HandleAutoRequest.”
at Line (63): “.ActivateRow iRow”.
I am getting this error when all the visible rows are searched and qtp is trying to activate the next row which is not visible
Please let me know how to handle this.
Thanks
GK
Hi,
I am also getting the same error message. Any updates on this?
Thank you,
Deepak
{ 1 trackback }