Just have your cfc return the results as a query, or as an array of structs.  
The first will be converted into an ArrayCollection of generic objects in Flex, 
and the second into an Array of objects.  Each of these objects will have a 
property for each column in the record.  

Flex will be quite happy with these object and will let you do pretty much 
anything you want to do with them.

You can use 

for (var key:String in recordObject) 

to get the property names.  Since your queries are going to be dynamic you are 
going to have to process them dynamically and this is how you do it.

You could also have your cfc return metadata about the result set, to tell you 
which properties are the primary keys, and anything else you need to know about 
the result to process it correctly.

Having the server return objects that automatically get converted to typed flex 
objects is great when you know what type of objects are going to be returned.  
But if you don't Flex can handle untyped dynamic objects just fine, and you 
should use them when the results of a service can't be known at compile time.

--- In [email protected], "postwick" <p...@...> wrote:
>
> I cannot predict at compile-time what the name (or properties) of the class 
> will be.  I need to CREATE the class at runtime, AND add the properties to 
> it.  It seems, so far, that this is not possible.
> 
> However, what I'm doing sounds very similar to your project.  It's not so 
> much the sheer number of tables (although a few dozen) but the fact that the 
> application allows the creation of new tables (so I need a new class) and 
> columns (so the properties might change).
> 
> I can easily have my app write new destinations to the config file for any 
> new table created.  I can even write the necessary CFCs to disk based upon 
> schema changes within the app.  But I cannot find a way to get the classes I 
> need.
> 
> All tables share the same foreign key column name, which is helpful.  My idea 
> is this...set up one class that has two properties - the foreign key and a 
> second column.  I would have one destination for each table, but all 
> destinations will point to the same class.  When my CFCs pull data, I will 
> have them return the primary key along with all other data encoded (XML or 
> something) into the second property.  Then on the client side I can manage it 
> by filling an ArrayCollection, then having a function that parses the actual 
> columns and rows (from the second property) into a second ArrayCollection 
> that my datagrid is actually bound to.  Creates/updates would go in the 
> reverse direction - placed into the second ArrayCollection and then processed 
> up to the two-property format for the first one, at which point LCDS will 
> take over.
> 
> As I think through it, this should work.  Thoughts?
> 
> --- In [email protected], "wrhinfl" <wrhinfl@> wrote:
> >
> > Ok, I think the way your question is worded can cause problems with the 
> > answer you get.
> > 
> > If your real question was "Can a class be modified during runtime and how?" 
> >  Would this be the same question you are asking?
> > 
> > I searched the ASDocs and found Dynamic Class, which allows you to add 
> > variables and functions to an instance of a class.  I created a simple 
> > application and uses one AS class twice, creating different variables and 
> > functions in the two instances.
> > 
> > The project I am working on is trying to do something very similar where I 
> > don't want hundreds of classes to match the hundreds of tables (and would 
> > require hundreds of java classes on the server).  
> > 
> > And your question made me do some searching, so let me know if this 
> > question and answer are closer to what you are trying to accomplish in your 
> > project and I can share my simple code (two files with 70 lines of code, no 
> > comments).
> > 
> > --- In [email protected], "postwick" <paul@> wrote:
> > >
> > > I want to store descriptions of classes in an external file (such as XML) 
> > > or database, and use them in my Flex application such that I can add, 
> > > remove, or change the classes in the external file with recompling the 
> > > Flex application.
> > > 
> > > Is there any way to do this?  In a nutshell, is there a way to create a 
> > > class through an Actionscript function, with a for loop where the 
> > > information that is looped over contains the definitions of the classes 
> > > loaded from an external source?
> > >
> >
>


Reply via email to