IIRC, you have an object like this:

 

Class TreeNode extends EventDispatcher

{

            public var children: ArrayCollection;

            public var name:String;

            public var level:int;

}

 

If the next row in the table has a higher level, you make a new AC and
assign it to the children prop and add that row to that AC.  I think I'd
do it recursively, and maybe return the level of a row that was lower
than the current working level so you can exit up the recursion stack
back to where you need to be.

________________________________

From: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of Don Kerr
Sent: Sunday, August 24, 2008 8:14 AM
To: [email protected]
Subject: [flexcoders] Re: Tree from flat query

 

Thanks Alex.
So, what does that hierarchy of ACs look like conceptually?

myTreeAC.name
myTreeAC.lvl
myTreeAC.lvlAC

myTreeAC.lvlAC.parentAC
myTreeAC.lvlAC.parentAC.parentid
myTreeAC.lvlAC.parentAC.name

myTreeAC.lvlAC.parentAC.teamAC.teamid
myTreeAC.lvlAC.parentAC.teamAC.name

Sounds like what you are suggesting is much less complex/less fixed
than this, but I'm not getting how lvl=2, becomes a child of lvl=1, etc.

I'm still new to the concept of hierarchy of ACs. So, I appreciate
your patience.

Thanks,
Don

--- In [email protected] <mailto:flexcoders%40yahoogroups.com>
, "Alex Harui" <[EMAIL PROTECTED]> wrote:
>
> To turn a flat table into a hierarchy, you create a custom
> ITreeDataDescriptor implementation.
> 
> 
> 
> However, in this case I would run through the table and convert it to
a
> hierarchy of ArrayCollections. Every time LVL goes up one, create an
> object with a children property that is an ArrayCollection and stuff
> objects with potential children property. When LVL goes down, start
> adding to the appropriate level.
> 
> 
> 
> ________________________________
> 
> From: [email protected] <mailto:flexcoders%40yahoogroups.com>
[mailto:[email protected] <mailto:flexcoders%40yahoogroups.com>
] On
> Behalf Of Don Kerr
> Sent: Saturday, August 23, 2008 7:42 AM
> To: [email protected] <mailto:flexcoders%40yahoogroups.com> 
> Subject: [flexcoders] Tree from flat query
> 
> 
> 
> I inherited a legacy sql server table (that I cannot change) that
looks
> like table below.
> 
> LVL is the unlimited levels within the tree (1-??), and within each
> level, there are unlimited parents and their unlimited children.
> 
> I use remoteObject to pull in the query result as a flatDP.
> 
> I want to feed this dynamic data to a Tree component or
AdvancedDataGrid
> tree. 
> 
> Can't get me head around how to deal with the unlimited number of
levels
> and how to convert the flatDP to a hierarchicalDP in Actionscript. Can
> anyone help?
> 
> Thanks!
> Don
> 
> I want the "NAME" to be what is visible in the tree at each node.
(this
> is the team name )
> 
> lvl1
> parent
> team
> lvl2
> parent
> team
> lvl3
> ! ; parent
> team
> parent
> team
> lvl1
> parent
> team
> lvl1
> parent
> team
> lvl2
> parent
> team
> lvl3
> parent
> team
> parent
> team
> 
> 
> 
> query
> 
> 
> 
> LVL
> 
> NAME
> 
> PARENTID
> 
> TEAMID
> 
> 1
> 
> 1 
> 
> CxP_SRR 
> 
> null 
> 
> 251 
> 
> 2
> 
> 2 
> 
> CxP_SRR_Board 
> 
> 251 
> 
> 252 
> 
> 3
> 
> 3 
> 
> CxP_SRR_PRE_Board 
> 
> 252 
> 
> 253 
> 
> 4
> 
> 4 
> 
> CxP_SRR_C3I 
> 
> 253 
> 
> 260 
> 
> 5
> 
> 4 
> 
> CxP_SRR_IM 
> 
> 253 
> 
> 257 
> 
> 6
> 
> 4 
> 
> CxP_SRR_MS 
> 
> 253 
> 
> 254 
> 
> 7
> 
> 4 
> 
> CxP_SRR_OTHER 
> 
> 253 
> 
> 262 
> 
> 8
> 
> 4 
> 
> CxP_SRR_PP&C 
> 
> 253 
> 
> 259 
> 
> 9
> 
> 4 
> 
> CxP_SRR_PTI 
> 
> 253 
> 
> 256 
> 
> 10
> 
> 4 
> 
> CxP_SRR_RQMT 
> 
> 253 
> 
> 255 
> 
> 11
> 
> 4 
> 
> CxP_SRR_SR&QA 
> 
> 253 
> 
> 258 
> 
> 12
> 
> 4 
> 
> CxP_SRR_T&V 
> 
> 253 
> 
> 261 
> 
> 13
> 
> 1 
> 
> ESMD 
> 
> null 
> 
> 5 
> 
> 14
> 
> 2 
> 
> Admin 
> 
> 5 
> 
> 12 
> 
> 15
> 
> 2 
> 
> Adv_Cap 
> 
> 5 
> 
> 7 
> 
> 16
> 
> 2 
> 
> CE 
> 
> 5 
> 
> 8 
> 
> 17
> 
> 2 
> 
> CMD 
> 
> 5 
> 
> 11 
> 
> 18
> 
> 2 
> 
> CX 
> 
> 5 
> 
> 1 
> 
> 19
> 
> 3 
> 
> AdvProj 
> 
> 1 
> 
> 28 
> 
> 20
> 
> 3 
> 
> ARES 
> 
> 1 
> 
> 15 
> 
> 21
> 
> 4 
> 
> ARES_Eng_Support 
> 
> 15 
> 
> 424 
> 
> 22
> 
> 4 
> 
> ARES_FITO 
> 
> 15 
> 
> 54 
> 
> 23
> 
> 5 
> 
> ARES_FITO_Avionics_Intg 
> 
> 54 
> 
> 407 
> 
> 24
> 
> 5 
> 
> ARES_FITO_Flt_Test_Intg 
> 
> 54 
> 
> 411 
> 
> 25
> 
> 5 
> 
> ARES_FITO_GVT 
> 
> 54 
> 
> 55 
> 
> 26
> 
> 5 
> 
> ARES_FITO_Orion_I 
> 
> 54 
> 
> 406 
> 
> 27
> 
> 5 
> 
> ARES_FITO_Propulsion_Test_Intg 
> 
> 54 
> 
> 410 
> 
> 28
> 
> 5 
> 
> ARES_FITO_SEVT 
> 
> 54 
> 
> 409 
> 
> 29
> 
> 5 
> 
> ARES_FITO_Veh_Sys_Assembly_Test 
> 
> 54 
> 
> 408 
> 
> 30
> 
> 4 
> 
> ARES_I 
> 
> 15 
> 
> 56 
> 
> 31
> 
> 5 
> 
> ARES_I_US 
> 
> 56 
> 
> 57 
> 
> 32
> 
> 6 
> 
> ARES_I_LIS 
> 
> 57 
> 
> 144 
> 
> 33
> 
> 6 
> 
> ARES_I_M_A 
> 
> 57 
> 
> 145 
> 
> 34
> 
> 6 
> 
> ARES_I_MPS 
> 
> 57 
> 
> 137 
> 
> 35
> 
> 6 
> 
> ARES_I_US_Avio 
> 
> 57 
> 
> 141 
> 
> 36
> 
> 6 
> 
> ARES_I_US_RCS 
> 
> 57 
> 
> 139 
> 
> 37
> 
> 6 
> 
> ARES_I_US_SEI 
> 
> 57 
> 
> 422 
> 
> 38
> 
> 6 
> 
> ARES_I_US_Struct_Therm 
> 
> 57 
> 
> 136 
> 
> 39
> 
> 6 
> 
> ARES_I_US_Test 
> 
> 57 
> 
> 143 
> 
> 40
> 
> 6 
> 
> ARES_I_US_TVC 
> 
> 57 
> 
> 140 
> 
> 41
> 
> 6 
> 
> ARES_US_Sm_Solids 
> 
> 57 
> 
> 423 
> 
> 42
> 
> 5 
> 
> ARES_I_USE 
> 
> 56 
> 
> 104 
> 
> 43
> 
> 4 
> 
> ARES_I_FS 
> 
> 15 
> 
> 106 
> 
> 44
> 
> 5 
> 
> ARES_I_FS_Avio_Ctrl 
> 
> 106 
> 
> 125 
> 
> 45
> 
> 6 
> 
> ARES_I_FS_Avio 
> 
> 125 
> 
> 428 
> 
> 46
> 
> 6 
> 
> ARES_I_FS_Ctrl 
> 
> 125 
> 
> 429 
> 
> 47
> 
> 5 
> 
> ARES_I_FS_Flt_Test 
> 
> 106 
> 
> 132 
> 
> 48
> 
> 5 
> 
> ARES_I_FS_RSRM_V 
> 
> 106 
> 
> 126 
> 
> 49
> 
> 6 
> 
> ARES_I_FS_Balli 
> 
> 126 
> 
> 420 
> 
> 50
> 
> 6 
> 
> ARES_I_FS_Insul 
> 
> 126 
> 
> 417
>

 

Reply via email to