Forum Discussion

abhagwat's avatar
abhagwat
Occasional Contributor
13 years ago

Flexgrid:- parse rows and cols and get cell value


Flexgrid:- parse rows and cols and get cell value.



Problem :- I am facing problem with respect to getting values from flex grid



Code i wrote :-

myvalue = aqObject.GetPropertyValue(Aliases.iexplore.UTM_HomePage.objectApp.mainMain1.canvasOrders.canvasOrderorders.dividedboxVdiv.orderdatagridOrdersgrid.FlexObject.dataProvider.source.item("2"),"Leaves")


msgbox myvalue


This produces error.



How do i parse cells via rows and columns of Flexgrid.

Dataprovider is [mx.collections::XMLListCollection object]. Source is represented as



"



I also tried using this code

a = Aliases.iexplore.UTM_HomePage.objectApp.mainMain1.canvasOrders.canvasOrderorders.dividedboxVdiv.orderdatagridOrdersgrid.FlexObject.dataProvider.source.value



<row idx="01-7902" meID="1" du="1" taNum="" clientOrderId="270" badgeNum="-1" agencyName="" rid="00V2M" status="Filled" tsTime="15:52:25.673758" symbol="JFP" side="Buy" broadSide="B" orderType="Limit" equoteType="" routeInst=" " size="1000" pxScale="4" price="10.01" dPrice="0.000000" delQty="0







which gives me XML Values in format mentioned here

looked at this post http://support.smartbear.com/viewarticle.aspx?aid=8970. However it seems that it does not assume dataprovider to be xmllist.



So two questions here.

How do i get cell values by referring rows,cols

Also is there any way to parse above pasted xml



Your help will be appreciated



Thanks



Amit



6 Replies

  • Hi Amit,



    Possibly, TestComplete can provide special support for the "orderdatagridOrdersgrid" grid if it fits the "mx.controls::DataGrid" class. To learn how to enable the support, please see the "FlexDataGrid Object" help topic. After that, you'll be able to work with your grid using the techniques listed in the "Working With Grids" help topic.



    However, if the grid doesn't fit the "mx.controls::DataGrid" class, please let me know the string value of the orderdatagridOrdersgrid.FlexObject property - I'll try to find out how to work with this control.
  • abhagwat's avatar
    abhagwat
    Occasional Contributor
    Thanks for your reply Mike.



    I did add mx.controls.AdvancedDataGrid(which is the base class for flexgrid) and also check the derived classess checkbox. However could not get the testobject properties reflected in control.



    What could be the alternative solution



    Thanks and Regards
  • Hi Amit,



    Thanks for letting me know the class name. The approach I suggested won't work for your grid. However, I have found an example of the same grid here, and the caption of the root "Southwest" node is accessible through the Sys.Process("iexplore").Page("http://www.silvafug.org/blogStuff/AutoSizingAdvancedDataGrid/AdvancedDataGridComponent.html").Object("AdvancedDataGridComponent").AdvancedDataGridComponent("AdvancedDataGridComponent").Panel("mx.controls.AdvancedDataGrid Example").AdvancedDataGrid("myADG2").AdvancedListBaseContentHolder(0).AdvancedListBaseContentHolder(0).AdvancedDataGridGroupItemRenderer(0).FlexObject.data.GroupLabel property. During the investigation, I used Internet Explorer 9 installed on Windows 7 and exposed the application using the FlashInjector.swf movie.



    So, you may need to use this or some other properties to accomplish your task.
  • abhagwat's avatar
    abhagwat
    Occasional Contributor

    Hello Support.


     


    Just one update here. Through the object mapping I added the testcomplete Advanceddatagrid class(/eg module.utp.Objecthrid) in default object properties. Now I am able to see additional properties such as wColumnCount,wValue etc. However when I try to provide parameters to wValue I get following error


     


    Error: An error occurred.


     


    Possible reasons:


     


    1. The application stopped responding.


     


    2. The application was compiled incorrectly (see the Open Applications topic in the help system).


     


    3. An error occurred in TestComplete.



    What should be the steps henceforth
  • Hi Amit,



    - I saw that use of this property is not recommended. http://community.smartbear.com/forum/post/?mode=singleThread&thread=88b1042f-547e-441a-8795-d1e5b35c6212


    You can use native members if you need. In this case, you may need to look for a property that will contain the needed data using the Properties page of the Object Browser panel, because the property suggested by Helen may be not applicable to your version of the control.



    - If I have to get values for all rows and columns(all the values in the grid), it becomes difficult. 


    Using the approach I suggested, you can iterate through all the children of the grid object which represent cells. To do this, you'll need to create a loop that will work with objects obtained through the FindAllChildren method. The method should look for the objects whose ObjectType property's value is equal to "AdvancedDataGridItemRenderer".



    Through the object mapping I added the testcomplete Advanceddatagrid class(/eg module.utp.Objecthrid) in default object properties


    As I said in my previous post, this approach won't work.