AdvancedDataGrid with XMLListCollection Syntax

Hello All,
I'm more of an XSLT/XPath guy, and need help with the syntax
for Flex(if that's the only thing I'm doing wrong!). I have an
XMLListCollection named "mapData" with records from a web service.
Each record looks like this:
<java:Results xmlns:java="java:com.example.com">
<java:AssociatedFileID>9999</java:AssociatedFileID>
<java:AssociatedFileName>example.csv</java:AssociatedFileName>
<java:DataBucketID>123</java:DataBucketID>
<java:DataBucketName>EDashboard</java:DataBucketName>
<java:Fields>
<java:DataBucketFieldName>Business</java:DataBucketFieldName>
<java:DataBucketFieldValue>Loans</java:DataBucketFieldValue>
<java:DataBucketFieldID>4281</java:DataBucketFieldID>
</java:Fields>
<java:Fields>
<java:DataBucketFieldName>Section</java:DataBucketFieldName>
<java:DataBucketFieldValue>Europe</java:DataBucketFieldValue>
<java:DataBucketFieldID>4394</java:DataBucketFieldID>
</java:Fields>
<java:LoadedDateTime>2008-03-19T10:57:21-04:00</java:LoadedDateTime>
<java:Suppressed>No</java:Suppressed>
<java:DataBucketContentID>170</java:DataBucketContentID>
<java:Status>Active</java:Status>
</java:Results>
My AdvancedDataGrid is:
<mx:AdvancedDataGrid x="10" y="10" id="MapDG"
designViewDataType="flat" width="100%" height="100%"
dataProvider="{mapData}" click="{editBtn.enabled=true;}"
selectionMode="singleRow" change="{editBtn.enabled=true;}">
<mx:columns>
<mx:AdvancedDataGridColumn headerText="ID"
dataField=""/>
<mx:AdvancedDataGridColumn headerText="Business"
dataField=""/>
<mx:AdvancedDataGridColumn headerText="Section"
dataField=""/>
</mx:columns>
</mx:AdvancedDataGrid>
Here's what I'm trying to do for each column:
1 - *::Results.*::DataBucketContentID.text()
//this is the record ID
2. -
*Results.*::Fields.(*::DataBucketFieldName.text()='Business').*DataBucketFieldValue.text( )
//Gets the 'DataBucketFieldValue' for each 'Fields' that has
a 'DataBucketFieldName' = Business
3. -
*Results.*::Fields.(*::DataBucketFieldName.text()='Section').*DataBucketFieldValue.text()
//Gets the 'DataBucketFieldValue' for each 'Fields' that has
a 'DataBucketFieldName' = Section
What do I need to put in the columns' dataField for this to
work?
Thanks,
Trav

Thanks to Tracy and a little research, I have my data grid
populating - I wanted to post an example that worked for me:
If below is a variable with your web service result...
private var personXML:XML=<persons>
<person>
<FirstName>Santa</FirstName>
<Surname>Claus</Surname>
<Age>1000</Age>
</person>
<person>
<FirstName>Tooth</FirstName>
<Surname>Fairy</Surname>
<Age>250</Age>
</person>
<person>
<FirstName>Travis</FirstName>
<Surname>Allen</Surname>
<Age>27</Age>
</person>
</persons>
You can use a function, which you'll need to assign to a
column. Here it is concating text in 2 elements but you can also
use it for namespaced elements (e.g.
item.*::NodeName1.*::NodeName2.text()).
private function showFullName(item:Object,
Column:DataGridColumn):String{
var fullName:String = item.FirstName + " " + item.Surname;
return fullName;
The first column uses the function to populate the data in
the column. It has to use labelFunction (vs. dataField). The 2nd
uses the node name directly.
<mx:DataGrid id="personDG"
dataprovider="{personXML.person}">
<mx:columns>
<mx:DataGridColumn width="150" headerText="Full Name"
labelFunction="showFullName"/>
<mx:DataGridColumn width="150" dataField="Age"
width="50"/>
<!--the column without header text wil take the value of
the element-->
</mx:columns>
</mx:DataGrid>
Hope this helps anyone else!
Trav

Similar Messages

  • What's wrong with my syntax?

    I'm getting an error with this. What's wrong with my syntax?
    Error: Scene 1, Layer 'actions', Frame 1, Line 21 1084: Syntax error: expecting rightparen before semicolon.
    // Line 21
    holder.load(new URLRequest("Interactive_StrategyMap.swf" + "?random=" + Math.random();));

    Hi Ned,
    I'm trying to force my preloader to load the .swf every time. I do not want it stored in cache (because I'm trying to solve the issue where the dynamic text doesn't load on refresh)
    So, I've added this math.random to the end of the string... but now the preloader .swf apparently can't see the .swf I want it to load because the path is Interactive_StrategyMap.swf?random=123 instead of Interactive_StrategyMap.swf
    The error I get is:
    completeHandler: Interactive_StrategyMap.swf?random=123
    Error #2044: Unhandled IOErrorEvent:. text=Error #2035: URL Not Found.
    My full code is:
    //THIS IS THE PRELOADER CONTAINER THAT LOADS THE INTERACTIVE
    //STRATEGY MAP (Interactive_StrategyMap.swf).
    // CREATE A NEW LOADER OBJECT TO HOLD THE LOADED CONTENT
    var holder:Loader = new Loader();
    var myString:String = "Interactive_StrategyMap.swf" + "?random=123" + Math.random();
    addChild(holder);
    // CREATE EVENT HANDLERS TO TRACK THE LOADING PROGRESS
    // AND TO TRACK THE COMPLETION OF THE LOADED CONTENT
    holder.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, onLoading);
    holder.contentLoaderInfo.addEventListener(Event.COMPLETE, onComplete);
    function onComplete(e:Event):void {
    this.loadingClip.visible = false;
    function onLoading(e:ProgressEvent):void {
    var pcent:Number = e.target.bytesLoaded / e.target.bytesTotal * 100;
    loadingClip.loadingText.text = int(pcent) + "%";
    // LOAD THE EXTERNAL CONTENT
    holder.load(new URLRequest(myString));
    trace("completeHandler: " + myString);

  • Use plan from stored_outlines from query with different syntax?

    Hello,
    I'd like to know is there any ability to use via stored_outlines plan from query with different syntax?
    Database version - 11.1.06
    If yes, maybe you'll take a look at steps (based on Metalink 726802.1), what I tried to do to make it work (with no success):
    alter session set create_stored_outlines=good;
    run good query
    create private outline good from SYS_OUTLINE_0... -< GOOD
    alter session set create_stored_outlines=bad;
    run bad query
    create private outline good from SYS_OUTLINE_0... -< BAD
    update ol$ set sql_text, textlen, signature, hash_value, hash_value2 from BAD to GOOD records
    leave ol$hintcount for GOOD untouched
    delete ol$ where ol_name='BAD';
    delete ol$hints where ol_name='BAD';
    delete ol$nodes where ol_name='BAD';
    execute dbms_outln_edit.refresh_private_outline('GOOD');
    alter session set sql_trace=true;
    alter session set use_private_outlines=true;
    run bad query
    examine trace file and find that it use execution plan different from both bad and good queries
    PS: Originally bad query is posted already Re: Poor performance while join of 2 comprehensive large views and small table
    PPS: Also I review thread CBO not picking correct indexes or doing Full Scans
    Thanks,
    Sergiy
    Edited by: kiberpress on Sep 30, 2009 6:59 AM

    A query with different syntax would result in a different hash value.
    Stored outlines work based on hash value.
    Your question is probably answered now.
    Sybrand Bakker
    Senior Oracle DBA

  • Char into balise jsp:scriptlet in jsp with xml syntax

    hello,
    i met a trouble with coding jsp with xml syntax,
    i use wsad to develop the jsp, and it's not allowed to put characters < or > into the balise scriptlet
    for example i cant do a loop (as i did easily with html syntax <% %> ) :
    this his the header of my jsp:
    <jsp:directive.page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1" />
    <jsp:text>
    <![CDATA[ <?xml version="1.0" encoding="ISO-8859-1" ?> ]]>
    </jsp:text>
    <jsp:text>
    <![CDATA[ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> ]]>
    </jsp:text>
    and the code which dont work:
    <jsp:scriptlet>
    for (int i=0;i<10;i++){
    System.out.println(i);
    </jsp:scriptlet>
    i get a compilation error, did someone could help me to code dynamic content jsp ?
    ps: excuse me for my english.

    I don't use xml, so I may be way off the wall, but did you try using the CDATA sections again?
    <jsp:scriptlet>
    <![CDATA[
    for (int i=0;i<10;i++){
    System.out.println(i);
    ]]>
    </jsp:scriptlet>

  • Problem with xmllistcollection

    Hi
         I am new in Flex programming world. I am facing the problem with xmllistcollection which is bind to datagrid. Please help me
         I have created the custom componet. In this custom datagrid component a column having combobox. the problem aries when there
    are two duplicate rows and if i change the value of one row's combobox value then another duplicate row's combobox value is autometically
    changed.
    as i have attached the images.image 1 shows initial stage and image2 shows when i changed 5 row's combobox value then 8th rows combobox
    value is autometically changed.
    this is the code for change of combox value. commented code shows what i have tried right now
    public function DropDownEvent(evt:ListEvent):void
                 var xmlvalues:XMLListCollection= DataGrid(_listData.owner).dataProvider as XMLListCollection;
                 //var xmlListval:XMLList= xmlvalues.source as XMLList;            
                 //    XMLNotifier.getInstance().unwatchXML(xmlListval,);
                 xmlvalues[_listData.rowIndex][_listData.dataField]=evt.target.selectedItem;
             //     var xml:XML=xmlvalues.getItemAt(_listData.rowIndex) as XML;
             //    var strval:String=xml.toString();
             //    var lval:int= strval.indexOf(_listData.dataField);
             //    var lvalLength:int=_listData.dataField.length+lval+1;
            //     var str1:String=strval.substr(0,lvalLength);
              //   var lval2:int=strval.indexOf("</",lvalLength);
              //   str1=str1+evt.target.selectedItem+" "+strval.substr(lval2);
              //  var xmlNew:XML=new XML(str1);
             //    xmlvalues.removeItemAt(_listData.rowIndex);
              //   xmlvalues.addItemAt(xmlNew,_listData.rowIndex);
                 //Alert.show(xmlvalues[_listData.rowIndex].toString());
               // evt.target.data[_listData.dataField]=evt.target.selectedItem;

    the problem seems to be due to watchxml notification function, which every time call when i try to change in the xmllistcollection. there may be the solution unwatchxml. but how to use unwatchxml in my code and what will be the notification function to remove ?
    please help !

  • Problems with INSERT  syntax ?

    Dear programmers,
    I am have a problem with INSERT Syntax,
    I have a table with 11 fields out of which one is auto_increment field(id), Now my problem is, Do i need to specifiy autoincrement field in INSERT statement. I dont thinks ?
    My Insert statement is as follows ,
    int result = st.executeUpdate("insert into tablename"
              +"(name, user_group, lage, preis, anmerkung, exp_uri, timestamp, nummer)"
              +"values +Objekt+"','"+Kategoriekey+"','"+Lage+"','"+Preis+"','"+Anmerkung+"','"+Dateiname+"','"+date.getTime()+"','"+ObjektID+"')");
    thanks in advance
    bye

    The answer to your question is maybe. Each database handles autoincrements differently. What database are you using?
    I also noticed that you are doing an insert using the standard Statement. You should look into using PreparedStatements for performance reasons and issues such as single quotes from within a string.
    Matt

  • Problem replacing  chart axis title  with &string. syntax

    Apex 4.1.1
    Hi,
    I am having a problem replacing a chart axis title with substitution syntax &P5_MYFIELD., where P5_MYFIELD is an item with Source Type PL/SQL Function Body:
    begin
    return web_message.show('LASTNAME', 'dk');
    end;
    The Item is defined on the same Page as the chart in a different region. I can see that function is working ok, because the return value is displayed in P5_MYFIELD.
    There is a second item in an other region on the same page where the source value is defined with substitution syntax &P5_MYFIELD. It also displays the expected value. But when I use the string &P5_MYFIELD. as axis title it is not displayed.
    I also defined a field P0_MYFIELD on Page Zero with the same function, when I reference that with &P0_MYFIELD. as axis title on Page 5 the value is displayed correctly. I tried the same with a field on Page 1, &P1_MYFIELD. and it is displayed correctly.
    I think, the chart axis title must be substituted before the item P5_MYFIELD is executing the PL/SQL function body to get its value. Can anyone tell me why?
    We want to use string substitution syntax to translate all our labels in different languages. I would like to create hidden items with source type PL/SQL function body for all labels on a page and reference these values as label definitions. I would like to place them on the same page as the labels.
    Thanks
    Anne

    I started the application again and now also the Items are not displayed, only the message 'Label not defined', so I probably did something wrong with the computation. Why the correct values were shown during the first run, I do not know, maybe i did not logout in between.
    Here is the debugging information, but I cannot see any error message:
    0.02844 0.00038 Computation point: Before Header 4
    0.02881 0.00032 ...Perform computation of item: P5_CYCLE, type=FUNCTION_BODY 4
    0.02913 0.00060 ...Performing function body computation 4
    0.02973 0.00464 ...Execute Statement: declare function x return varchar2 is begin begin return web_message.show('CYCLE','de'); end; return null; end; begin wwv_flow.g_computation_result_vc := x; end; 4
    0.03437 0.00042 ......Result = Wurf 4
    0.03479 0.00046 ...Session State: Save "P5_CYCLE" - saving same value: "Wurf" 4
    0.03526 0.00027 Processes - point: BEFORE_HEADER 4
    0.03553 0.00027 ...close http header 4
    0.03580
    Edited by: Anne-Marie Rosa on Jun 8, 2012 10:09 AM
    Now the correct value is displayed again in the P5_MYFIELD, because I had to set the item source back to PL/SQL Function body, but I am still getting the chart error and the chart is not displayed.
    Edited by: Anne-Marie Rosa on Jun 8, 2012 10:17 AM

  • Vertically scrolling an AdvancedDataGrid with custom ItemRenderers results in corruption

    I've logged a jira item about this ...
    http://bugs.adobe.com/jira/browse/FLEXDMV-2667
    It's probably a good idea to throw it open to the forum as well to see if anyone has encountered this before.
    In short, I have an AdvancedDataGrid with custom ItemRenderers on each of the columns that are responsible for rendering the cell data. If the ADG is resized so that it's not all visible, and the scrollbar is scrolled all the way up and all the way down a couple of times, and the ADG is then resized again so that all the rows are visible, there's something very wrong with the result. Basically it looks as though extra rows are being drawn behind the existing ones, all on top of one another, resulting in a corrupted display.
    I've actually gotten it to reproduce itself every time, if you check out the jira item above for executable code and follow the instructions you should see it, and there's a screenshot of the result as well.
    As I detail in the jira commentary, it's definately something to do with the renderers. As the scroll bar is moved up and down extra renderers are consantly being created, and old ones don't seem to be GC'd at any point, and furthermore seem to be drawn onscreen even when they're not being used to explicitly draw the cells of the ADG. If this -is- the case then there's a memory leak here as well.

    Throwing the code inline to make it easier to try out ...
    ADGItemRendererIssue.mxml:
    <?xml version="1.0" encoding="utf-8"?>
    <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
                   xmlns:s="library://ns.adobe.com/flex/spark"
                   xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600"
                   creationPolicy="all"
                   creationComplete="init()">
        <s:layout>
            <s:BasicLayout/>
        </s:layout>
        <fx:Script>
            <![CDATA[
                import ADGIssue.*;
                import mx.collections.*;
                import mx.controls.*;
                import mx.controls.advancedDataGridClasses.*;
                import mx.core.IFactory;
                import mx.events.AdvancedDataGridEvent;
                import mx.events.ListEvent;
                import spark.components.supportClasses.ItemRenderer;
                [Bindable]
                public var expenses:ArrayCollection = new ArrayCollection([
                    {Expense:"Taxes", Amount:100, Cost:80, Discount:20},
                    {Expense:"Rent", Amount:200, Cost:90, Discount:21},
                    {Expense:"Bills", Amount:300, Cost:100, Discount:22},
                    {Expense:"Books", Amount:400, Cost:110, Discount:23},
                    {Expense:"Food", Amount:500, Cost:120, Discount:24},
                    {Expense:"Goldfish", Amount:600, Cost:130, Discount:25}
                public var cache:Dictionary = new Dictionary(true);
                protected function init():void
                    var grp:AdvancedDataGridColumnGroup = new AdvancedDataGridColumnGroup();
                    grp.headerText = "Expenses";
                    grp.dataField = "Expense";
                    grid.groupedColumns = new Array();
                    grid.groupedColumns.push(grp);
                    grp = new AdvancedDataGridColumnGroup();
                    grp.headerText = "Finances";
                    grp.children = new Array();
                    var col:AdvancedDataGridColumn = new AdvancedDataGridColumn();
                    col.headerText = "Amount";
                    col.dataField = "Amount";
                    col.itemRenderer = new ADGIssueItemRendererFactory("Amount");
                    grp.children.push(col);
                    col = new AdvancedDataGridColumn();
                    col.headerText = "Cost";
                    col.dataField = "Cost";
                    col.itemRenderer = new ADGIssueItemRendererFactory("Cost");
                    grp.children.push(col);
                    col = new AdvancedDataGridColumn();
                    col.headerText = "Discount";
                    col.dataField = "Discount";
                    col.itemRenderer = new ADGIssueItemRendererFactory("Discount");
                    grp.children.push(col);
                    grid.groupedColumns.push(grp);
                    grid.dataProvider = expenses;
            ]]>
        </fx:Script>
        <fx:Declarations>
            <!-- Place non-visual elements (e.g., services, value objects) here -->
        </fx:Declarations>
        <mx:VDividedBox x="35" y="29" width="80%" height="600">
            <mx:AdvancedDataGrid  height="400" id="grid" designViewDataType="flat"  width="100%"/>
            <s:TextArea text="just some text to take up a wee bit of space" width="100%"/>
        </mx:VDividedBox>
    </s:Application>
    ADGIssueItemRendererFactory.as (in package ADGIssue)
    package ADGIssue
        import flash.utils.Dictionary;
        import mx.core.IFactory;
        public class ADGIssueItemRendererFactory implements IFactory
            private var _label:String;
            public function ADGIssueItemRendererFactory(label:String)
                trace("Creating Factory for: "+label);
                _label = label;
            public function newInstance():*
                return new ADGIssueItemRenderer(_label);
    ADGIssueItemRenderer.as (also in package ADGIssue)
    package ADGIssue
        import components.*;
        import mx.controls.Label;
        import mx.controls.listClasses.*;
        import mx.core.*;
        import mx.logging.ILogger;
        import mx.logging.Log;
        import mx.logging.LogEventLevel;       
        public class ADGIssueItemRenderer extends Label implements IDataRenderer
            private var _label:String;
            private var countvalue = 0;
            private static var count:int = 0;
            public function ADGIssueItemRenderer(label:String)
                trace("Creating Renderer for: "+label+" with count: "+count);
                _label = label;
                this.countvalue = count;
                count ++;
            override public function set data(rowData:Object):void
                if (rowData)
                    this.text = countvalue+":"+rowData[_label];
                    trace("RENDERING: "+this.text);
    run the MXML and follow the instructions in the JIRA item ...
    1. resize the ADG so that not all of the ADG is visible vertically, and the verticle scrollbar is shown. In the example attached the ADG is in a split panel, so the split bar can be dragged up to conceal some of the rows and display the scrollbar.
    2.  drag the scroll thumb all the way to the top of the scrollbar, and all the way to the bottom and back to the top several times.
    3.  Resize the ADG again so that all the rows are visible.
    and the corruption should be clear to see. Here's a screenshot of what it looks like:
    Anyone ever seen anything similar ? And if so, any workarounds or fixes ?

  • AdvancedDataGrid with multiple custom sort functions

    I have an AdvancedDataGrid with several levels of nested data in which each level needs to have a custom sort.
    Ex:
    A
         Z
              C
              D
              A
         Y
              C
              D
              A
         X
              C
              D
              A
    B
         Z
              C
              D
              A
    etc...
    Is this possible without a massive sort function that takes every possible combination into account? Better yet, I'm already sorting it in SQL - can I disable the automatic sort and just have it spit out the data in the order XML passes it to ActionScript?
    Thanks

    Thanks for the tip, but unfortunately that's not what I'm looking for. I'm not trying to remove the end users' ability to sort, I'm trying to disable the automatic alphabetic sort that the ArrayCollection/AdvancedDataGrid does when it first renders the table. I know it can be overridden by using the "compareFunction" callback, but the compareFunction only iterates through the rows once, and I effectively need something that will iterate through 3 times - one for each nesting level.
    The cookbook suggests concatenating the fields and then applying the sorting logic, but that works best if you're applying the same sort to every level of nesting. In my case, it means a massive function along the lines of:
    switch(concat_fields1) {
         case 'AZC':
              switch(concat_fields2) {
                   case 'AZD':
                        return 1;
                        break;
                   default:
                        return -1;
                        break;
              break;
         case 'AZD':
              etc.
    So far, that's the only solution I've found.

  • What is going on with the syntax of XMLTABLE?

    Hello! What is that with the syntax XMLTABLE? For example
    from tgc_xml tt2, xmltable('/ROWSET/ROW' passing tt2.xml_field) tgc;
    That is first I have to declare the table in front of the function call, then, after a comma, call a function with that table. How do I write such functions? If I can't do that in PL/SQL, how did Oracle did it?
    [Oracle documentation|http://docs.oracle.com/cd/E11882_01/appdev.112/e23094/xdb_xquery.htm#CBAHBFGE]
    Oracle documentation says:
    Whenever a PASSING clause refers to a column of an XMLType table in a query, that table must appear before the XMLTable expression in the query FROM list. This is because the XMLTable expression depends on the XMLType table — a left lateral (correlated) join is needed, to ensure a one-to-many (1:N) relationship between the XMLType table row accessed and the rows generated from it by XMLTable.

    Hi,
    That is first I have to declare the table in front of the function call, then, after a comma, call a function with that table. How do I write such functions? If I can't do that in PL/SQL, how did Oracle did it?What's so confusing about it? It's a built-in function based on the SQL/XML standards, just like XMLElement, XMLAgg etc.
    Conceptually, we can see XMLTable as a pipelined table function, with a syntax of its own.
    Something like this, for instance, is not that much different, and it's available to us in (PL/)SQL :
    SELECT x.*
    FROM my_table t
       , TABLE(
           my_pipefunction(t.col1, t.col2)
         ) x
    ;

  • Having trouble with the syntax when trying to only print some random pages from a multi page documen

    Having trouble with the syntax when trying to only print some random pages from a multi page document.  So far in the Print Selection Area, I have chosen "pages" and then typed 1,3-4 so as NOT to print page 2 but this does not seem to work. - Help Please

    In my updated firefox, the print button does NOT open print preview first.
    How can I access print preview function?

  • I would like to capture all the SQL and  PL/SQL   with full syntax that is

    Hi
    I would like to capture all the SQL and PL/SQL with full syntax in a sequence that is being executed in the last 30 or 40 min for a particular session in sqlplus.
    Enabling SQL trace is not an option.
    Will appreciate your input.
    thanks
    KS
    Edited by: user12710695 on May 22, 2010 11:08 PM

    Welcome to the Forum.
    Most important information (especially for such queries) is Oracle Version.
    Is AUDITING an option?
    Flashback can provide UNDO SQL.
    For SQL there are many options...
    1. LOGminer
    sudhakar@ORCL>desc dba_hist_sqltext;
    Name                                                  Null?    Type
    DBID                                                  NOT NULL NUMBER
    SQL_ID                                                NOT NULL VARCHAR2(13)
    SQL_TEXT                                                       CLOB
    COMMAND_TYPE                                                   NUMBER2. SELECT SQL_TEXT FROM DBA_HIST_SQLTEXT WHERE SQL_ID IN (SELECT SQL_ID FROM V$ACTIVE_SESSION_HISTORY WHERE USER_ID = ???)
    vr,
    Sudhakar B.
    Edited by: Sudhakar_B on May 23, 2010 8:35 AM

  • AdvancedDatagrid with a summary row

    Hello,
    I have an AdvancedDatagrid with two grouping fields in a
    summary row.
    Everything works fine when there is no labelFunction
    associated with it.
    But as soon as I specify a labelFunction, the summary row
    fields are empty. I need a labelFunction to format dates and
    numbers.
    How to write a proper labelFunction for an AdvancedDatagrid
    with a summary row ?
    Regards,
    Karl.

    Okay, I figured it out.
    Now, I have two label functions set at the
    AdvancedDataGridColumn level for the summary row fields and one
    labelFunction set at the AdvancedDataGrid level for all the other
    fields.
    <mx:AdvancedDataGridColumn id="amountTotal"
    dataField="sumAmount" labelFunction="sumAmountLabelFunction" />
    <mx:AdvancedDataGridColumn id="collectedTotal"
    dataField="sumCollected" labelFunction="sumCollectedLabelFunction"
    />
    In order to avoid a null pointer exception on the sumAmount
    and sumCollected fields in the label function, I use the
    hasOwnProperty() method to check before access. Otherwise, this
    exception will happen while expanding the tree.
    private function sumAmountLabelFunction(item:Object,
    column:AdvancedDataGridColumn):String
    if(item.hasOwnProperty("sumAmount"))
    return this.numberFormatter.format(item.sumAmount);
    return "";
    private function sumCollectedLabelFunction(item:Object,
    column:AdvancedDataGridColumn):String
    if(item.hasOwnProperty("sumCollected"))
    return this.numberFormatter.format(item.sumCollected);
    return "";

  • Need help with e4x syntax for children in ADG TreeView column

    I would like to display Hierarchical XML data as a treeView
    in a ADG control. I can bind the first (parent) level of my XML to
    the ADG using a HierarchicalData Dataprovider, but I can't figure
    out the syntax to get the children.
    The attached code shows the function where the XML is
    received, and evaluated one level deep. The var "eventdefs" is the
    ..Group nodes of the XML, and the declaration of the ADG. The ADG
    binds the eventdefs as hierarchical data, and specifies one column
    with the datafield as @eventgroup. This works fine and shows the
    top level nodes.
    I have specified Event as the childrenfield, but I don't see
    anything in the data grid - nor do I understand how to specify a
    different value of datafield for the second level of nodes.
    I want to show the value of the attribute "eventgroup" on
    parent nodes, and show the value of the attribute "description"
    next to the child nodes. Can this be specified in the mxml? Or do I
    need a label function, or something else?
    TIA!
    Here is my XML document:
    <list>
    <Group eventgroup="">
    <Event uniqueid="63" description="Error:enter valid Email
    Address " displayorderingroup="60" displayorder="86" />
    <Event uniqueid="64" description="Error:unable to find
    account for email address " displayorderingroup="61"
    displayorder="87" />
    </Group>
    <Group eventgroup="CEP Events">
    <Event uniqueid="244" description="CEP:EveryHit; "
    displayorderingroup="242" displayorder="253" />
    </Group>
    </list>
    <mx:Script>
    <![CDATA[
    [Bindable("eventDefsChanged")]
    private var _eventDefs:Object;
    public function set eventDefs(m:Object):void
    // We expect m to be a XML document, with "Group" as the
    name of the highest level (parent) nodes
    _eventDefs = m..Group;
    adg_es.dataProvider = eventDefs;
    adg_es.validateNow();
    dispatchEvent( new Event( "eventDefsChanged" ) );
    public function get eventDefs():Object
    return _eventDefs;
    ]]>
    </mx:Script>
    <mx:AdvancedDataGrid id = "adg_es"
    displayItemsExpanded="true">
    <mx:dataProvider>
    <mx:HierarchicalData id ="hd" source = "{new
    HierarchicalData(eventDefs)}" childrenField="Event"/>
    </mx:dataProvider>
    <mx:columns>
    <mx:AdvancedDataGridColumn dataField="@eventgroup"/>
    </mx:columns>
    </mx:AdvancedDataGrid>

    Use TAKE function 
    int numberOfrecords=10; // read from user
    listOfItems.OrderByDescending(x => x.CreatedDate).Take(numberOfrecords)

  • AdvancedDataGrid with HTTPService

    Hi All,
    I have problem with AdvancedDataGrid by using
    HTTPService.Actually i don't know how to get the data from xml file
    and display in AdvancedDataGrid but i know how to get the data from
    xml file and display in DataGrid.
    Here XML file structure is different.......
    How to get and display the data in AdvancedDataGrid.If u have
    a example please send it to me.
    here am posting my code.....
    MXML code ..................
    <?xml version="1.0"?>
    <mx:Application xmlns:mx="
    http://www.adobe.com/2006/mxml"
    creationComplete="salesRequest.send();">
    <mx:Script>
    <![CDATA[
    import mx.collections.XMLListCollection;
    import mx.rpc.events.ResultEvent;
    [Bindable] public var salesDP:XMLListCollection;
    private function salesResultHandler(event:ResultEvent):void{
    salesDP = new XMLListCollection(event.result.Category);
    ]]>
    </mx:Script>
    <mx:HTTPService id="salesRequest" useProxy="false"
    resultFormat="e4x"
    result="salesResultHandler(event)" url="adg.xml"/>
    <mx:AdvancedDataGrid width="100%" height="100%">
    <mx:dataProvider>
    <mx:HierarchicalData source="{salesDP}"/>
    </mx:dataProvider>
    <mx:columns>
    <mx:AdvancedDataGridColumn dataField="@Category"
    headerText="Category"/>
    <mx:AdvancedDataGridColumn dataField="@Product"
    headerText="Product"/>
    <mx:AdvancedDataGridColumn dataField="@InStock"
    headerText="In Stock"/>
    <mx:AdvancedDataGridColumn dataField="@OnOrder"
    headerText="On Order"/>
    </mx:columns>
    </mx:AdvancedDataGrid>
    </mx:Application>
    XML file........
    <?xml version="1.0″ encoding="utf-8″ ?>
    <Category Category="Poultry">
    <Category Category="Chicken">
    <Product Product="skinless breasts"
    InStock="565 lbs" OnOrder="1000 lbs"/>
    <Product Product="thighs"
    InStock="385 lbs" OnOrder="700 lbs"/>
    <Product Product="nuggets"
    InStock="230 lbs" OnOrder="400 lbs"/>
    </Category>
    <Category Category="Turkey">
    <Product Product="whole turkeys"
    InStock="1565 lbs" OnOrder="2000 lbs"/>
    <Product Product="turkey burger"
    InStock="1365 lbs" OnOrder="1200 lbs"/>
    <Product Product="turkey ham"
    InStock="640 lbs" OnOrder="700 lbs"/>
    </Category>
    </Category>
    Thanks in advance,
    Premadas.

    See my Flex Cookbook post:
    Populating
    an AdvancedDataGrid from an XML file using HTTPService
    Or see my blog post, which seems like where you got the data
    anyway:
    Using HTTPService to
    Populate an AdvancedDataGrid

Maybe you are looking for

  • How to use parallel dynamic block in guided procedures!!

    hi My application is as following i have to initiate a process from a webdynpro for java application and after that i have to send the action to the multiple users.. For that i created a parallel block inside that a sequential block and inside that a

  • How to switch the keyboard language when using a bluetooth keyboard?

    When using the on-screen keyboard I have the little globe to switch languages, but when using a bluetooth keyboard the on-screen keyboard is hiden. I want to be able to write in different languages using the bluetooth keyboard, also the auto-correct

  • Copy price conditions from order to invoice

    Dear experts, I have a problem I can't solve myself ! When we create an invoice from an order, the conditions are copied using a predefined pricing procedure in customizing ... Now, I think I have a strange problem ... When the conditions are copied

  • LG Vortex sending and recieving picture messages

    This is my first smartphone and I am to able to send or recieve picture messages. It just says sending or downloding but nothing happens. Can anhyone help me please?

  • How to make  the main payload be sent as mail body

    Hi, Currently, I want to send out a mail with several attachments by Mail adapter. And <b>the main payload</b> should be sent out as <b>mail body</b> instead of attachment. I know by default, the main payload is also sent as a attachment. So I used t