12 Replies Latest reply on Jun 10, 2009 5:41 AM by Threadstone

    Drill Down in Flex 3

    Threadstone Level 1

      Hello All,

       

      I have a Column Chart for which the data source is  mysql database.I'm using PHP to interact with the database.

       

      I need a Drill down example for this scenario.

       

      Can anyone provide this please.

       

       

      Many thanks..

        • 1. Re: Drill Down in Flex 3
          Michael Borbor Level 4

          This example shows you how to drill down in a chart.

           

          http://www.adobe.com/devnet/flex/samples/dashboard/dashboard.html

           

          It doesn't use a callback to PHP, but as you've already now how to do that, that won't be an issue for you.

          • 2. Re: Drill Down in Flex 3
            Threadstone Level 1

            Thank you Michael, Its a Good One.

             

            I tried doing my requirement, interacting to mysql using PHP. While drilling down a chart, I still face few issues.

             

            I have written "if" conditions in my PHP...when ever I click on the chart I send a parameter to my PHP file.

             

            Based on the parameter it executes SQL Queries and Returns XML.

             

            This Idea is not working...I still get an error which I'm not sure of.

             

            Can anyone help ?.

             

             

            Error: Unknown Property: 'invoice'.

            at mx.collections::ListCollectionView/http://www.adobe.com/2006/actionscript/flash/proxy::getProperty()[C:\autobuild\3.2.0\frame works\projects\framework\src\mx\collections\ListCollectionView.as:694]

            at mx.binding::PropertyWatcher/updateProperty()[C:\autobuild\3.2.0\frameworks\projects\frame work\src\mx\binding\PropertyWatcher.as:293]

            at Function/http://adobe.com/AS3/2006/builtin::apply()

            at mx.binding::Watcher/wrapUpdate()[C:\autobuild\3.2.0\frameworks\projects\framework\src\mx\ binding\Watcher.as:182]

            at mx.binding::PropertyWatcher/updateParent()[C:\autobuild\3.2.0\frameworks\projects\framewo rk\src\mx\binding\PropertyWatcher.as:199]

            at mx.binding::Watcher/updateChildren()[C:\autobuild\3.2.0\frameworks\projects\framework\src \mx\binding\Watcher.as:128]

            at mx.binding::PropertyWatcher/updateProperty()[C:\autobuild\3.2.0\frameworks\projects\frame work\src\mx\binding\PropertyWatcher.as:302]

            at Function/http://adobe.com/AS3/2006/builtin::apply()

            at mx.binding::Watcher/wrapUpdate()[C:\autobuild\3.2.0\frameworks\projects\framework\src\mx\ binding\Watcher.as:182]

            at mx.binding::PropertyWatcher/updateParent()[C:\autobuild\3.2.0\frameworks\projects\framewo rk\src\mx\binding\PropertyWatcher.as:199]

            at mx.binding::Watcher/updateChildren()[C:\autobuild\3.2.0\frameworks\projects\framework\src \mx\binding\Watcher.as:128]

            at mx.binding::PropertyWatcher/updateProperty()[C:\autobuild\3.2.0\frameworks\projects\frame work\src\mx\binding\PropertyWatcher.as:302]

            at Function/http://adobe.com/AS3/2006/builtin::apply()

            at mx.binding::Watcher/wrapUpdate()[C:\autobuild\3.2.0\frameworks\projects\framework\src\mx\ binding\Watcher.as:182]

            at mx.binding::PropertyWatcher/eventHandler()[C:\autobuild\3.2.0\frameworks\projects\framewo rk\src\mx\binding\PropertyWatcher.as:325]

            at flash.events::EventDispatcher/dispatchEventFunction()

            at flash.events::EventDispatcher/dispatchEvent()

            at mx.rpc::AbstractInvoker/http://www.adobe.com/2006/flex/mx/internal::resultHandler()[C:\autobuild\3.2.0\frameworks\ projects\rpc\src\mx\rpc\AbstractInvoker.as:190]

            at mx.rpc::Responder/result()[C:\autobuild\3.2.0\frameworks\projects\rpc\src\mx\rpc\Responde r.as:43]

            at mx.rpc::AsyncRequest/acknowledge()[C:\autobuild\3.2.0\frameworks\projects\rpc\src\mx\rpc\ AsyncRequest.as:74]

            at DirectHTTPMessageResponder/completeHandler()[C:\autobuild\3.2.0\frameworks\projects\rpc\s rc\mx\messaging\channels\DirectHTTPChannel.as:403]

            at flash.events::EventDispatcher/dispatchEventFunction()

            at flash.events::EventDispatcher/dispatchEvent()

            at flash.net::URLLoader/onComplete()

            Thanks & Regards,

            • 3. Re: Drill Down in Flex 3
              Threadstone Level 1

              Somebody Halp me plzzzzz

              • 4. Re: Drill Down in Flex 3
                Michael Borbor Level 4

                Attach your full project or post the whole code to see what's wrong.

                 

                Sincerely,

                 

                Michael

                 

                El 13/05/2009, a las 7:58, Threadstone <forums@adobe.com> escribió:

                 

                >

                Somebody Halp me plzzzzz

                >

                • 5. Re: Drill Down in Flex 3
                  Threadstone Level 1

                  My PHP file returns something like this.

                   

                   

                   

                   

                  if($cust=="XXXX")

                  {

                   

                   

                  $Query= <--- SQL Query>;

                   

                  /* fetching data and output as xml */

                   

                  print "<invoice_details>\n";

                  while( $Row = mysql_fetch_object( $Result ) )

                  {

                  print "<invoice><inv_num>".$Row->inv_num."</inv_num>"."<po_num>".$Row->po_num."</po_num>"."<inv _date>".$Row->inv_date."</inv_date>"."<billing_from>".$Row->billing_from."</billing_from>" ."<billing_to>".$Row->billing_to."</billing_to>"."<curr>".$Row->curr."</curr>"."<vat>".$Ro w->vat."</vat>"."<inv_amt_wo_vat>".$Row->inv_amt_wo_vat."</inv_amt_wo_vat>"."<inv_desc>".$ Row->inv_desc."</inv_desc>"."<inv_submit_date>".$Row->inv_submit_date."</inv_submit_date>" ."<payment_terms>".$Row->payment_terms."</payment_terms>"."<due_date>".$Row->due_date."</d ue_date>"."<due_date_cust>".$Row->due_date_cust."</due_date_cust>"."<amt_paid>".$Row->amt_ paid."</amt_paid>"."<inv_status>".$Row->inv_status."</inv_status>"."<credit_note>".$Row->c redit_note."</credit_note>"."<credit_note_num>".$Row->credit_note_num."</credit_note_num>" ."<proj_desc>".$Row->proj_desc."</proj_desc>"."<cust_name>".$Row->cust_name."</cust_name>" ."<flcb>".$Row->flcb."</flcb>"."<days>".$Row->days."</days></invoice>\n";

                  }

                  print "</invoice_details>";

                   

                  }

                  • 6. Re: Drill Down in Flex 3
                    Michael Borbor Level 4

                    Post your Flex code as well.

                    • 7. Re: Drill Down in Flex 3
                      Threadstone Level 1

                      <?xml version="1.0" encoding="utf-8"?>

                      <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">

                      <mx:HTTPService id="get_ovduereport" url="http://localhost/inv_overdue-debug/inv_overdue.php"  method="POST" />

                       

                      <!--<mx:HTTPService id="get_ovduereport" url="http://localhost/inv_overdue-debug/inv_overdue.php"  method="POST"  resultFormat="text" result="resultHandler(event)" />-->

                       

                      <mx:Script>

                      <![CDATA[

                       

                       

                        import mx.controls.Alert;

                        import mx.validators.NumberValidator;

                       

                        

                           import mx.rpc.events.ResultEvent;

                                     

                                      /*HTTPService result callback*/

                                      public function resultHandler( event:ResultEvent ):void

                                      {

                                          Alert.show("Result " + String( event.result ) );

                                      }

                       

                       

                       

                          

                           

                       

                      private function datasend(Data:String):void {

                       

                      /*Alert.show(Data);*/

                      var objData:Object = new Object;

                                                    objData.cust_name =Data;                                                    

                                                    get_ovduereport.send(objData);

                                            

                       

                      }

                      ]]>

                      </mx:Script>

                      <mx:Panel title="Column Chart" x="182" y="276" width="378" height="372">

                      <mx:ColumnChart id="myChart" dataProvider="{get_ovduereport.lastResult.invoice_details.invoice}" showDataTips="true" width="356" height="332">

                         <mx:horizontalAxis>

                            <mx:CategoryAxis

                                 dataProvider="{get_ovduereport.lastResult.invoice_details.invoice}"

                                 categoryField="cust_name"

                            />

                         </mx:horizontalAxis>

                         <mx:series>

                            <mx:ColumnSeries

                                 xField="cust_name"

                                 yField="vat"           

                                 displayName="Vat" width="5" click="datasend(get_ovduereport.lastResult.invoice_details.invoice.cust_name)"

                            />

                           

                            <mx:ColumnSeries

                                      xField="cust_name"

                                      yField="days"

                                      displayName="Days" click="datasend(get_ovduereport.lastResult.invoice_details.invoice.cust_name)"

                                 />      

                         </mx:series>

                      </mx:ColumnChart>

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

                      </mx:Panel>

                       

                       

                      </mx:Application>

                      • 8. Re: Drill Down in Flex 3
                        Michael Borbor Level 4

                        Change the resultFormat to E4X

                        • 9. Re: Drill Down in Flex 3
                          Threadstone Level 1

                          Hi Michael, The line of code you are talking about is commented.....!

                           

                          Please check once !

                          • 10. Re: Drill Down in Flex 3
                            Michael Borbor Level 4

                            Sorry I missed that, please next time you post code use the Syntax Highlighting - Java, this feature makes it easier to read code.

                            • 11. Re: Drill Down in Flex 3
                              Michael Borbor Level 4

                              Have you tried debuggin the event.result to see if it's getting filled properly.

                              • 12. Re: Drill Down in Flex 3
                                Threadstone Level 1

                                Hello Micheal,

                                 

                                Sorry for the late response.

                                 

                                I tried displaying the result as you suggested.

                                 

                                I'm getting   "[Object] [Object] "

                                 

                                I think still there is some problem.Do you have any other guesses.

                                 

                                or Can you just provide me an example on similar lines....along with the DB tables.

                                 

                                I'll try here..

                                 

                                Many thanks.