Flex 3 Tree - XML Object-Relational Underground

I need to say, I am really excited about this. First, I have always liked the tree component, and entirely amazed at being able to use it.  Like the hammer, I think it’s going to be the best fix-it tool in my bag. On investigation, most of the examples seem to be from the Flex 2 period and either too complex to carry out the simple task, or so terse it left me wondering what was going on. I was getting a little frustrated until I rediscovered if I read the instructions, sometimes this pays off too.

The Adobe Flex Tree Control is really a challenging component.  Before leveraging this awesome tool an understanding of just what is going on with the server side is vital.  My configuration is not important, but I guess I should discuss this for a bit.
There are a few server components you need to have inplace before trying this at home. A relational database is not required, but unless your totally locked into useing an xml database, which is entirely possible, you need to be well versed with the dbms of your choice. You need to have a reasonable understanding of how to either generate your SQL or write your own. A major part of my experience has been within a Windows environment, so an understanding of ODBC or ADO is not required, however, the other routes are not easy, which means your going to need to connect directly through a TCPIP connection, DBMS propritary communication port, or utilizing a JRE2 based connection. One of which your going to need to understand. Another item your going to need to know how to do is configure your internet server.  You are also going to need to pick a webpage application type. If you understand all of that, then I am speaking to the right person.   My system configuration: Windows XP professional (with latest ODBC jet dll’s), apache 2, php, and a MS Access database.

The php is used to connect to the database using a dsn-less connection:Â
1) Define the php page content
2) Define the php xml page output
3) bound the xml content with a root item; echo(”“);
4) Define a query, update, or delete
5) Connect to the database and test connection
6) Design your SQL
$sql =”SELECT
7) get the next row from the query result table and assign to variables
8) parse xml from the data names and use variable names for xml labels and values
9) close the connection

The field names from an sql Access query are posted with minor editing into the php page. think about the content that needs to be fed into the Adobe Flex Tree component. A hint, your nodes are going to be where you have primary key’s or foreign keys which is where a logical relationship exist between the data elements. The xml content needs to be parsed to create the content and you need to include both the content of the field and your labeling of the node and or the leaf of the tree. You can either code this… or I prefere to use a spreadsheet to parse it out.

Now that you have your sql, and xml nicely formated in your php file, test it to make sure the content is what goes into the Tree Control.

Post a Comment

Your email is never published nor shared. Required fields are marked *