2 Replies Latest reply on Apr 8, 2007 9:20 PM by JoeADSK

    Works great so far but...

      I am trying to produce a flex demo to present to my work next week.
      I have done the Flex/Coldfusion art tutorial and created several windowed pages accessing the data with coldfusion.
      It has worked great. But the real reason for using this is the charts. My work uses coldfusion so i have been trying to use the Coldfusion/Flex wizard to build a query and a page to use the query.

      I created a master page called ChartTest and used the query
      FROM ART
      Now im not sure what code i need to show for this so i will include the cfc and mxml
      I woould like to know what i need to put in the MXML file to display a bar chart that has the names of the paintings in the x field and the cost as a bar (simple enough, im just a newb).

      thanks for any help!
      Here is the cfc---

      <cffunction name="getMasterQuery" output="false" access="remote" returntype="query">
      <cfargument name="ID" required="false">
      <cfset var qRead="">
      <cfquery name="qRead" datasource="cftutorial">
      FROM ART
      <cfreturn qRead>

      And here is the MXML file that uses it----

      <?xml version="1.0" encoding="utf-8"?>
      <cfComponents:SizeableTitleWindow xmlns:mx=" http://www.adobe.com/2006/mxml" xmlns="*"
      showCloseButton="true" close="WindowManager.remove(this);" >

      import com.adobe.windowedApplication.managers.WindowManager;
      import mx.core.UIComponent;
      import mx.collections.ArrayCollection;
      import mx.utils.ObjectUtil;
      import mx.controls.Alert;
      import mx.rpc.events.FaultEvent;
      import mx.rpc.events.ResultEvent;
      private var currentIndex:int = 0;

      private var _key:Object;

      public function get key():Object
      return this._key;
      public function set key(key:Object):void
      this._key = key;

      private function initComponent():void

      public function refreshList(event:Event):void


      * RemoteObject result and error handlers
      private function server_fault(event:FaultEvent):void
      // dump error message
      Alert.show( ObjectUtil.toString(event.fault) );

      private function getMasterQuery_result(event:ResultEvent):void
      Alert.show( ObjectUtil.toString(event.result) );
      this.masterList.dataProvider = event.result as ArrayCollection;
      this.masterList.selectedIndex = this.currentIndex;

      private function deleteItem_result(event:ResultEvent):void
      Alert.show( ObjectUtil.toString(event.result) );

      destination="ColdFusion" source="ArtExample.components.cfgenerated.ChartTest">
      <mx:method name="getMasterQuery" result="getMasterQuery_result(event)" fault="server_fault(event)" />
      <mx:method name="deleteItem" result="deleteItem_result(event)" fault="server_fault(event)" />

      <mx:HBox width="100%" height="100%">

      <mx:BarChart id="Chart" dataProvider="{dataManager.getMasterQuery}" > (<---- not sure if this is right)
      <mx:BarSeries id="C1"
      xField="" (<---- dont know what to put in these)


      <mx:Legend dataProvider="{Chart}"/>


      width="100%" height="100%" top="0" left="0" right="0" bottom="0">
      <mx:DataGridColumn dataField="ARTNAME" headerText="ARTNAME" />
      <mx:DataGridColumn dataField="PRICE" headerText="PRICE" />


      Thanks so much for your help!
        • 1. Re: Works great so far but...
          well i would go to borders or barnes and nobels and find Adobe Flex 2 Training from the Source. They did the exact thing that you want. it is towards the back of the book. i havent gotten there im only half way done. sorry couldnt be much of a help
          • 2. Re: Works great so far but...
            JoeADSK Level 1
            I've found that it is the way the query is handled when it is returned. It is set as an array collection in most of the examples i have found. (One example is the "hello world"done in the coldfusion/flex devnet site). Does anyone know how a query is returned into an arrayCollection? and maybe give a code snippet of accessing data from a query as an arrayCollection, especially as a chart.