You probably want a List of Maps. Is this coming from a ResultSet from
jdbc? In Java-ish pseudo-code, you'd do something like this:

- List<Map<String,Object>> list = new ArrayList<Map<String,Object>>();
- For each row in the result set
-- Map<String,Object> row = new HashMap();
-- For each column in the result set metadata
--- row.put(column name, row value)
-- list.add(row)

and then return the list to Flex.

-- 
Maciek Sakrejda
Truviso, Inc.
http://www.truviso.com

-----Original Message-----
From: netdeep <deep...@chartertn.net>
Reply-to: flexcoders@yahoogroups.com
To: flexcoders@yahoogroups.com
Subject: [flexcoders] building a dataprovider in Java
Date: Wed, 15 Apr 2009 13:03:03 -0000




I posted a few weeks back about how to create a chart dataprovider in
Java to pass to Flex and the response I got back was to use Maps. I got
sidetracked with other aspects of the code and now that I'm trying to
code it, I am really drawing a blank. How would you create the following
dataprovider in Java without using a custom object (i.e., the next data
structure may have more or less elements than this one and I would need
to use generic names for each data pair)?

public var expenses:ArrayCollection = new ArrayCollection([
{Month:"Jan", Profit:2000, Expenses:1500},
{Month:"Feb", Profit:1000, Expenses:200},
{Month:"Mar", Profit:1500, Expenses:500}
]);







Reply via email to