AdvancedDataGrid - create Array (cfquery) with children for hierarchical data set

I'm trying to create an AdvancedDataGrid with a hierarchical
data set as shown below. The problem that I am having is how to
call the data from a ColdFusion remote call and not an
ArrayCollection inside of the Flex app (as below). I'm guessing
that the problem is with the CFC that I've created which builds an
array with children. I assume that the structure of the children is
the issue. Any thoughts?
Flex App without Remoting:
http://livedocs.adobe.com/labs/flex3/html/help.html?content=advdatagrid_10.html
<?xml version="1.0"?>
<!-- dpcontrols/adg/GroupADGChartRenderer.mxml -->
<mx:Application xmlns:mx="
http://www.adobe.com/2006/mxml">
<mx:Script>
<![CDATA[
import mx.collections.ArrayCollection;
[Bindable]
private var dpHierarchy:ArrayCollection= new
ArrayCollection([
{name:"Barbara Jennings", region: "Arizona", total:70,
children:[
{detail:[{amount:5}]}]},
{name:"Dana Binn", region: "Arizona", total:130, children:[
{detail:[{amount:15}]}]},
{name:"Joe Smith", region: "California", total:229,
children:[
{detail:[{amount:26}]}]},
{name:"Alice Treu", region: "California", total:230,
children:[
{detail:[{amount:159}]}
]]>
</mx:Script>
<mx:AdvancedDataGrid id="myADG"
width="100%" height="100%"
variableRowHeight="true">
<mx:dataProvider>
<mx:HierarchicalData source="{dpHierarchy}"/>
</mx:dataProvider>
<mx:columns>
<mx:AdvancedDataGridColumn dataField="name"
headerText="Name"/>
<mx:AdvancedDataGridColumn dataField="total"
headerText="Total"/>
</mx:columns>
<mx:rendererProviders>
<mx:AdvancedDataGridRendererProvider
dataField="detail"
renderer="myComponents.ChartRenderer"
columnIndex="0"
columnSpan="0"/>
</mx:rendererProviders>
</mx:AdvancedDataGrid>
</mx:Application>
CFC - where I am trying to create an Array to send back to
the Flex App
<cfset aPackages = ArrayNew(1)>
<cfset aDetails = ArrayNew(1)>
<cfloop query="getPackages">
<cfset i = getPackages.CurrentRow>
<cfset aPackages
= StructNew()>
<cfset aPackages['name'] = name >
<cfset aPackages
['region'] = region >
<cfset aPackages['total'] = total >
<cfset aDetails
= StructNew()>
<cfset aDetails['amount'] = amount >
<cfset aPackages
['children'] = aDetails >
</cfloop>
<cfreturn aPackages>

I had similar problems attempting to create an Array of
Arrays in a CFC, so I created two differents scripts - one in CF
and one in Flex - to build Hierarchical Data from a query result.
The script in CF builds an Hierarchical XML document which is then
easily accepted as HIerarchical Data in Flex. The script in Flex
loops over the query Object that is returned as an Array
Collection. It took me so long to create the XML script, and I now
regret it, since it is not easy to maintain and keep dynamic.
However, it only took me a short while to build this ActionScript
logic, which I quite like now (though it is not [
yet ] dynamic, and currently only handles two levels of
Hierarchy):
(this is the main part of my WebService result handler)....
// Create a new Array Collection to store the Hierarchical
Data from the WebService Result
var categories:ArrayCollection = new ArrayCollection();
// Create an Object variable to store the parent-level
objects
var category:Object;
// Create an Object variable to store the child-level
objects
var subCategory:Object;
// Loop through each Object in the WebService Result
for each (var object:Object in results)
// Create a new Array Collection as a copy of the Array
Collection of Hierarchical Data
var thisCategory:ArrayCollection = new
ArrayCollection(categories.toArray());
// Create a new instance of the Filter Function Class
var filterFunction:FilterFunction = new FilterFunction();
// Create Filter on the Array Collection to return only
those records with the specified Category Name
thisCategory.filterFunction =
filterFunction.NameValueFilter("NAMETXT", object["CATNAMETXT"]);
// Refresh the Array Collection to apply the Filter
thisCategory.refresh();
// If the Array Collection has records, the Category Name
exists, so use the one Object in the Collection to add Children to
if (thisCategory.length)
category = thisCategory.getItemAt(0);
// If the Array Collection has no records, the Category Name
does not exist, so create a new Object
else
// Create a new parent-level Object
category = new Object();
// Create and set the Name property of the parent-level
Object
category["NAMETXT"] = object["CATNAMETXT"];
// Create a Children property as a new Array
category["children"] = new Array();
// Add the parent-level Object to the Array Collection
categories.addItem(category);
// Create a new child-level Object as a copy of the Object
in the WebService Result
subCategory = object;
// Create and set the Name property of the child-level
Object
subCategory["NAMETXT"] = object["SUBCATNAMETXT"];
// Add the child-level Object to the Array of Children on
the parent-level Object
category["children"].push(subCategory);
// Convert the Array Collection to a Hierarchical Data
Object and use it as the Data Provider for the Advanced Data Grid
advancedDataGrid.dataProvider = new
HierarchicalData(categories);

Similar Messages

  • Is it possible to create DVD Templates with Motion for burning Blue Ray DVDs from Final Cut Pro X?

    Is it possible to create DVD Templates with Motion for burning Blue Ray DVDs from Final Cut Pro X?

    As far as I know, motion templates can only be used with DVD Studio Pro. FCP X only lets you add a background image to the DVD menu.

  • How to create a generic with iMovie for iPad?

    How do i create A generic with iMovie for iPad?

    luckyuis wrote:
    Hi All,
    > I have generated a report showing data for past 12 months and after that i need to include a chart showing Month on X axis with data for past 12 months ..for example if i run the report for June 2011 then on the chart it should take as june 11..>may 11..>april 11........so on june 10 with respect to other values
    >
    > fyi .. i am using type: Numeric Axis..> Date Axis line chart and created seperate formule on top of date field to get past 12 months data
    >
    > Please advise how can i do that on the chart
    >
    > Thanks much,
    > Lucky
    Once you pull the data, goup on the date monthly, most recent first ,and then graph the summaries in the group.

  • Stop user creating process order with material for specific order type

    Hey Team,
    Is there a way where I can stop creating process order with material for specific order type says Z*. We are using ZNMA  order type to create trial batch and we do not want to create process order with material for this order type.
    Any ideas?
    Thanks
    Bhavesh Patel.

    You can restrict the order creation in CO01 based on authorization, Remove the authorization for Z order type for the particular user,  Check with your basis Guy

  • Tree interface concept for hierarchical data creation/modification

    I am designing an interface for hierarchical data creation and maintenance. The interface will have to provide all basic data modifications options:
    edit an existing node, add new child/parent/sibling, as well as removing, sorting, dragging and dropping nodes around. Flex tree control is fully capable of all these functions while coding is not going to be a simple task. Has anyone worked on something like this? Any conceptual ideas?
    Thanks

    WOW Odie! You're awesome !! It worked like a charm, I created a view as you suggested:
    CREATE OR REPLACE FORCE VIEW "VIEW_TASKS_PROJECTS_TREE" ("ID", "PARENT_ID", "NODE_NAME") AS
    SELECT to_char(id) as id
    , null as parent_id
    , project_name as node_name
    FROM eba_task_projects
    UNION ALL
    SELECT to_char(id)
    , to_char(project_id)
    , task_name
    FROM eba_task_tasks;
    And then I created a new tree with the defaults and customized the Tree query a bit (just added the links really):
    select case when connect_by_isleaf = 1 then 0
    when level = 1 then 1
    else -1
    end as status,
    level,
    "NODE_NAME" as title,
    null as icon,
    "ID" as value,
    null as tooltip,
    'f?p=&APP_ID.:22:&SESSION.::NO::P22_ID,P22_PREV_PAGE:' || "ID" || ',3' as link
    from "#OWNER#"."VIEW_TASKS_PROJECTS_TREE"
    start with "PARENT_ID" is null
    connect by prior "ID" = "PARENT_ID"
    order siblings by "NODE_NAME"
    Thanks man, you saved me a lot of time and headaches :)

  • How do I create a track with just controller MIDI data in it?

    How can I create a track with just MIDI controller data in it? 
    For example: I'd like to create a track that issues a bank change/patch change and sets the default volume for that track, and that's it.
    I can then use this setup as a template for future projects.
    How can I do this?
    It seems like LPX will not allow me to enter any controller data into a track without first defining a region. However, it seems that LPX also won't allow me to create a region with just controller data in it. 
    Ideas?
    Thanks
    -Mike

    Soniq2 wrote:
    How can I create a track with just MIDI controller data in it? 
    For example: I'd like to create a track that issues a bank change/patch change and sets the default volume for that track, and that's it.
    I can then use this setup as a template for future projects.
    How can I do this?
    Let me qualify, I'm using Logic 9, not upgrading for various reasons.
    Is this for an external Instrument? If so it's very easy to do using the inspector, but first you have to create an instrument in the environment. (at least in L9 and the way I do it, which is old school)  Here's an example of an external instrument setup in the Environment.
    A multi Instrument is created, channels 1, 2, 3, & 9 are active. Patch names are entered, format for bank change is selected. (just happens I selected channel 14 to open the patch names).  This Instrument will now appear in the arrange page, and you can set patch change, bank change, volume & pan.

  • Not all my titles are showing for each data set

    Hello,
    I have made a column graph for 4 different data sets, I need the titles to show for each data set along the X axis. I highlight the titles in my data when making the graph, however, only two of the four are showing. Is there any way I can get all 4 to show?
    ^^^^ Need the title after Baseline and after Numb Hand
    Thank you

    Try clicking the chart then the blue 'Edit Data References' rectangle, and then in the lower left of the window switch from 'Plot Columns as Series' to 'Plot Rows as Series'.  Then switch back if needed. All four should then show up.
    SG

  • Need help in creating a view with Encryption for hiding the code used by the multiple users

    Hi,
    Can anyone help me out in creating view with encryption data to hide the stored procedure logic with other users.
    I have create a stored procedure with encryted view but while running this manually temporary views are getting created, therefore the problem is if there are 500 entries then 500 temp views will get created.
    Any solution to aviod creating temporary views, please refer my code below
    USE [etl_validation]
    GO
    /****** Object:  StoredProcedure [dbo].[Pr_DBAccess_mod]    Script Date: 05/23/2014 12:53:22 ******/
    SET ANSI_NULLS ON
    GO
    SET QUOTED_IDENTIFIER ON
    GO
    ALTER PROCEDURE [dbo].[Pr_DBAccess_mod](@ETL_CONFIG_ID INT)
    AS
    BEGIN
    DECLARE @openquery NVARCHAR(MAX),
     @DATABASENAME NVARCHAR(100),
     @HIERNAME NVARCHAR(100),
     @TABLENAME NVARCHAR(100),
     @SERVERTYPE NVARCHAR(100),
     @SERVERNAME NVARCHAR(100),
     @USERNAME NVARCHAR(100),
     @PASSWORD NVARCHAR(100),
     @ETL_CONFIG_IDN NVARCHAR(100);
     SET @ETL_CONFIG_IDN=CAST(@ETL_CONFIG_ID AS NVARCHAR);
     SET @TABLENAME='Department';
     SET @SERVERTYPE='SQL';
     SET @SERVERNAME ='192.168.31.176';
     SET @DATABASENAME='AdventureWorks2008R2';
     SET @HIERNAME = 'HumanResources';
     IF @SERVERTYPE='SQL'
     BEGIN
    /*SET @openquery= 'SELECT * INTO ##TestTable
                     FROM OPENROWSET(''SQLNCLI'',''server=192.168.31.176;Trusted_Connection=yes;'','''+@query+''')'
    SET @openquery=  'CREATE VIEW '+@TABLENAME+@ETL_CONFIG_IDN+
                     ' WITH ENCRYPTION AS SELECT * FROM OPENROWSET(''SQLNCLI'',''SERVER='+@SERVERNAME+';TRUSTED_CONNECTION=YES;'',''SELECT * FROM '+@DATABASENAME+'.'+@HIERNAME+'.'+@TABLENAME+''')'
    SELECT @openquery
    END
    EXECUTE sp_executesql @openquery
    END

    Hi aa_rif,
    According to your description and code message, you execute the sp_executesql statement in your stored procedure, it indeed create many views with a tablename and ETL_CONFIG_ID named. If you need not to use these temporary views, you can delete them when
    it contains the tablename in one view name.  
    In addition, if you want to create view with encryption in SQL Server, you can use directly the ENCRYPTION option to encrypt the T-SQL of a view in create view commands, for more information, see:
    http://learnsqlserver.in/4/Create-View-With-Encryption.aspx. if not, you can descript more detail about requriements, so that more forum members can involve into the thread and help you
    out. 
    Regards,
    Sofiya Li
    Sofiya Li
    TechNet Community Support

  • Can we create a form with dreamweaver for muse

    Hello,
    I need help because please because I want to create a form with choices and I can't do it with muse. I would like to know if someone can tell me if i can do it with dreamweaver and insert into muse after.
    Thank you for your help.

    Hi creatike,
    Why not use Adobe muse itself for forms?
    Configuring forms (and more) in Adobe Muse
    Thanks,
    Preran

  • Get the Values with null for all dates

    hi,
     i have a scanrio to get the sales trend. The data look like below
    CREATE TABLE #T1
    ( Item varchar(50),
    SalesDate Date,
    Quantity int
    INSERT INTO #T1 VALUES ('Item1', '2013/02/01', 3)
    INSERT INTO #T1 VALUES ('Item2', '2013/02/01', 5)
    INSERT INTO #T1 VALUES ('Item1', '2013/02/02', 2)
    INSERT INTO #T1 VALUES ('Item1', '2013/02/03', 6)
    INSERT INTO #T1 VALUES ('Item2', '2013/02/03', 4)
    SELECT * FROM #T1
    Here i have 2 items sales details for 3 days. So user can get the sales trend by passing StartDate and EndDate as 2 parameters.  But it will return the existing date values only. In this example Item2 not have sales record in the table for '2013/02/02'
    But needs to give null values in the select Query
    My Existing Output
    Item SalesDate Quantity
    Item1 2013-02-01 3
    Item2 2013-02-01 5
    Item1 2013-02-02 2
    Item1 2013-02-03 6
    Item2 2013-02-03 4
    My expected output is
    Item SalesDate Quantity
    Item1 2013-02-01 3
    Item2 2013-02-01 5
    Item1 2013-02-02 2
    Item2 2013-02-02 null
    Item1 2013-02-03 6
    Item2 2013-02-03 4
    Can you help to write the query. I wrote using CTE but if the ITem is single value its ok. But for multiple items how can i get the empty dates

    akhil,
    Check if this helps you:
    --CREATE TABLE #T1
    --( Item varchar(50),
    -- SalesDate Datetime,
    -- Quantity int
    --INSERT INTO #T1 VALUES ('Item1', '2013/02/01', 3)
    --INSERT INTO #T1 VALUES ('Item2', '2013/02/01', 5)
    --INSERT INTO #T1 VALUES ('Item1', '2013/02/02', 2)
    --INSERT INTO #T1 VALUES ('Item1', '2013/02/03', 6)
    --INSERT INTO #T1 VALUES ('Item2', '2013/02/03', 4)
    SELECT * FROM #T1
    declare @tab TABLE(date_col datetime)
    insert @tab select '2013/02/01'
    insert @tab select '2013/02/02'
    insert @tab select '2013/02/03'
    ;with cte
    as
    select * from
    (select distinct Item from #t1) a
    cross join
    (select date_col from @tab) b
    select c.item,c.date_col,t.Quantity from cte c
    left join #T1 t on c.Item=t.item and c.date_col=t.SalesDate
    You have the following options for the population of @tab (that decodes the dates for which values are to be obtained):
    either explicitly as i have done
    using a select statement on #T1 like, insert @tab select distinct SalesDate from #T1
    or for past three days means, something like - getdate(),getdate()-1 and getdate()-2
    Thanks,
    Jay
    <If the post was helpful mark as 'Helpful' and if the post answered your query, mark as 'Answered'>

  • Creating a view with "today" as the date

    Hello!
    I have a project tasks list which includes start date and due date. I'm creating a sort of dashboard webpage in which I'd like to have this project tasks list included in two separate webparts, each with a different due date.
    The first webpart and view will show all items for which the start date is the current date or "today" (every day it will show different items, as "today" is constantly changing).
    The second view will show items which have due dates for the next three upcoming business days.
    I'm assuming that this will be a filter on the view, but woul dlike to hear any recommendations.
    Thanks!
    Tom

    Cameron has it spot on. I'd also suggest applying this to a calendar view of the list, so that you have a more visual representation of the dates.
    Steven Andrews
    SharePoint Business Analyst: LiveNation Entertainment
    Blog: baron72.wordpress.com
    Twitter: Follow @backpackerd00d
    My Wiki Articles:
    CodePlex Corner Series
    Please remember to mark your question as "answered" if this solves (or helps) your problem.

  • Error in creating RSDS using transfer rules for master data datasources

    Hi ,
    when i am creating the transfermations(RSDS) using transfer rules for master data datasources while i want to migrate datasource.it is giving the error message saying that INITIAL ERROR OCCURED DURING GENERATION OF THE TRANSFERMATION.AND in the taskbar it is giving the message LOG IS BEING LOADED.
    MY QUESTION IS HOW CAN WE SEE THE LOG? AND
    PLEASE GIVE ME THE STEPS TO MIGRATE MASTER DATASOURCES.
    THANKS IN ADVANCE .

    Hi Ankit,
                  Yoy have to load data to the cube.For that you need update rules.
    Steps to load data to the cube
    1.Replicate the datasource.
    2.Assign Infosource
    3.Create transfer rules
    4.Maintain the update rules to the cube.
    5.Right click on the datasource and schedule an infopackage for it.
    Execute the Infopackage and pull the data to the cube.
    Hope this helps
    Regards
    Karthik

  • Date Format for Spry data set sort

    Hi
    Just feeling my way through the use of Spry Datasets for the
    first time and have a couple of issues hopefully someone with more
    knowledge of it than me know the answer to.
    I had an issue with my Spry Dataset initially that it would
    not work in ie7 but was OK in FF3.
    After some mucking round I realised the error I was getting -
    albeit obscure in IE was telling me it was a date format issue in
    my data set.
    The db data I am playing with here is fairly simple: I have a
    couple of text fields, an integer field that contains the
    unixtimestamp of the entry (its a simple diary application) and a
    formal date field that holds the same date in mysql's date format.
    When I display the date in the dataset I do so in the format
    "23rd May 2009" (as an example)- I code this using phps date
    function in my xml query.
    I had set this field to date format in the Spry dataset
    conditions but IE seems to barf on this- I can change it to
    textstring but then my sort is done on Alpha/Numeric sort of the
    first character in the date field which is rubbish.
    I only display the date in this format and one of the other
    text fields in my dataset- the unixdate is for programmatic
    purposes not general display so I cannot sort on this field if its
    invisible. How can I acheive a date based sort with this set up- or
    what date formats does Spry code prefer for date sorts? (My client
    wants the date to show as I have explained). Many thanks. I have a
    second query which I will post separately!
    Kenny

    "Tanushiheadbash" <[email protected]> wrote
    in message
    news:gqa70o$iat$[email protected]..
    > I think I follow what you are saying and in fact I think
    its what I
    > already
    > have. I have set the sort order to use the unixtime when
    the page
    > initially
    > loads and thats OK.
    I am sorry, but you aren't following my explanation. English
    isn't my mother
    tongue, and I am not able to explain it any better.
    > However what I need to be able to do is to have the
    AJAX/Javascript sort
    > (done in this case with Spry- ) to sort on the date when
    the column header
    > is
    > clicked. The problem I have is the date format in this
    visible column is
    > in
    > DDth Month YYYY format and Spry does not recocnise this
    as a date format-
    > it
    > wants it as a string ( or ie gives an error). Maybe its
    not possible what
    > I am
    > trying to do- just thought there might be a clever way
    to implement this.
    You can take a look at this page:
    http://visual.unipv.it/tmt_calendar/admin/reports/events.cfm
    Even if all the dates here are incidentally using the
    yyyy-mm-dd format, the
    dataset display the date from the "start_date_formatted"
    field:
    <td><a href="javascript:"
    onclick="showUpdate('{event_id}')">{start_date_formatted}</a></td>
    But uses another field to sort the table:
    <th scope="col" spry:sort="start_date">Start
    date</th>
    You can have the same date, using two different formats,
    inside two,
    separated dataset fields. One is used for display, the other
    one is used for
    sort.
    You may try to read again my previous explanations, look at
    the code in the
    page above and see if you get the idea.
    Massimo Foti, web-programmer for hire
    Tools for ColdFusion, JavaScript and Dreamweaver:
    http://www.massimocorner.com

  • DRILL DOWN REPORT FOR DIFFERENT DATA SETS in 11G

    Hello.
    My requirment is to do a drill down report with 2 data sets.
    My first data set have all the chart of accounts , My second data set have all the transactions.
    in my report i have 2 data tables. One with the accounts , and when i click in one account get all the transactions for selected account in the second data table.
    Anyone know how i can do this
    Any help would be apreciatted
    Paulo

    You can use the drill down strategy, well described by my friend Kan:
    http://bipconsulting.blogspot.com/2010/02/drill-down-to-detail-or-another-report.html
    regards
    Jorge
    p.s If this answers your question then please grant the points and close the thread

  • Req. for Graph Data set

    Hi all,
    I am in need of a graph data set with the format as: graph name, x coordinate and y coordinate.
    I will appreciate if anybody having this, pl. send it to me. Send some help like, the link address where I can download or an idea how to generate it.
    Thanks in advance,
    Shaw.

    Thank you for your quick response.  I have tried this and got two tables but only input per given time.  Her is an example below of what data needs to be inputted. 
    Todays date
    112.5
    0.004758855
    225
    0.003022459
    337.5
    0.005110742
    450
    0.006503629
    562.5
    0.008989879
    675
    0.007626316
    787.5
    0.003847718
    900
    0.00263287
    1012.5
    0.001321671
    1125
    0.00139917
    1237.5
    0.00314185
    1350
    0.006394711
    1462.5
    0.012263686
    1575
    0.010973433
    1687.5
    0.001998216
    1800
    0.001878826
    1912.5
    0.002599357
    There are 3600 lines of this...all grouped in one moment in time.

Maybe you are looking for