Hi,
I have a dropdown object in the SwfTable. When I activated on the cell, dropdown object is present. I want get data in dropdown but cannot. Please help me.
Thanks.
Let's start out with what is the SwfTable, and what is the DropDown object. Use the .NET Windows Forms Spy(under the Tools Menu) and click on the object. It should tell you it's type name. Either that or you can use the ObjectSpy, and Click on the object, and see what the SwfTypeName is.
Second are you using Infragistics products, NetAdvantage and TestAdvantage, and if so what versions?
Third what data are you trying to get? Are you trying to get the list of data? Perhaps including a screenshot of the SwfTable, and the Dropdown, dropped down, and highlight the information that you want to garner.
Hi Mike,
I'm using TestAdvantage and NetAdvantage 2007 vol 2. My problem as below:
1. Click on cell in the SwfTable, dropdown object is present
2. Click on dropdown/combobox object, list of data is present
I want get list of data of the dropdown/combobox object
Please help me ASAP
Hello,
The method to find out the contents of a drop down within the grid will depend on how the drop down was put into the grid. This could be an editor control or a ValueList. For this information, you will have to contact your developers.If a ValueList has been used, then you could get the count from the ValueListItems.Count of the columns ValueList. You could then loop through an get the DataValue or the DisplayText for each ValueListItem. The following is sample VB script that accomplishes this:Dim ItemCountItemCount = SwfWindow("Form1").SwfTable("ultraGrid1").GetNAProperty("DisplayLayout.Bands[0].Columns[Department].ValueList.ValueListItems.Count")Dim strValuesstrValues=""For i = 0 to ItemCount -1 step 1 strValues = strValues & ", " & SwfWindow("Form1").SwfTable("ultraGrid1").GetNAProperty("DisplayLayout.Bands[0].Columns[Department].ValueList.ValueListItems[" & i & "].DataValue")NextMsgBox strValues
In the above script example, Department is the key of the column with the value list.
Let me know if you have any questions with this matter.
Alan
Alan,
Is there a similar solution for TestAdvantage 2006 Vol 2 CLR 1.x? I'm using QTP 9.2 with TestAdvantage 2006 Vol 2 CLR 1.x and I'm getting the following Run Error: "Getting property value for ValueListItems throws the following exception: Invalid Property name: Property ValueListItems not found".
Thank you,
Dennis
Dennis,
There is more than one way to add a drop down column to a grid and the method that I provided may not apply to all cases. Do you know how the drop downs are being added to the grid in your case?
If you are unsure, you may need to ask the developers who work on the application you are testing. Once you find this out, let me know what method is being used and I will take a closer look at this specific case.
Thank you for the reply. If I understand my developer correctly, the drop-down is being added to the grid using a ValueList (e.g. Grid.ValueList).
I've tried using the sample code you provided earlier in the post, but I'm getting the Run Error I detailed previously ("Getting property value for ValueListItems throws the following exception: Invalid Property name: Property ValueListItems not found"). I'm not sure if my syntax is incorrect or if the version of TestAdvantage I'm using (TestAdvantage 2006 Vol 2 CLR 1.x) does not support that property.
SwfWindow("Company").SwfTable("GridName").GetNAProperty("DisplayLayout.Bands[0].Columns[UserName].ValueList.ValueListItems.Count")
Thanks,
The script that I posted before will work with TestAdvantage 2006 Volume 2 CLR 1.x. I have tested this myself using the attached sample (WindowsApplication1.zip) in QTP 9.2. You could test the sample on your machine with the above script to see if it works correctly on your machine as well to elimiate the environment as a possible factor. Note the sample needs to be compiled.
If the sample runs without issue with the script that I have previously provided, then the drop down in your application is most likely added to the grid in another way. Please verify how this is added.
Hi Alan,
Thank you for the sample. It works correctly for me using the following code:
MsgBox SwfWindow("Form1").SwfTable("ultraGrid1").GetNAProperty("DisplayLayout.Bands[0].Columns[Department].ValueList.ValueListItems.Count")
Apparently I misunderstood my developer and the dropdown in my application has been added in a different way, so I've attached a screenshot to give you an idea of what I'm dealing with as the developer is out of the office today (it basically looks like a grid within the drop-down).
Any direction you can give me will be appreciated as I'd like to be able to pull a count of items within the dropdown and in some instances the content of a particular column within the dropdown.
Thanks again,