0 Replies Latest reply on Sep 5, 2006 12:37 PM by GeorgeWS

    URL / RemoteObject / CFC

    GeorgeWS Level 1
      I have this:

      http://www.youngsmarket.com/youngsmarket/programs/inventory/inventory/bin/Inventory.swf?Su pplierID=30

      If you press download on the upper right the SupplierID gets sent to a cfm page that loads in excel. This part works and only gets the Suppliers that are equal to 30

      The data that comes in initialy into the grid is all of the data. I dont want that though. That is my problem. I need the SupplierID to go to the RemoteObject and get sent along to my CFC. I cannot get the syntax right for this. bellow is ALL of my code for the APP and below that is the CFC. Can anyone show me what is wrong with my RemoteObject Statement. ANd what the CFC SHOULD look like to receive the variable (SupplierID).

      <?xml version="1.0" encoding="utf-8"?>
      <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml" layout="absolute" creationComplete="initVars()" >

      <mx:Script>
      <![CDATA[
      import mx.rpc.events.ResultEvent;
      import mx.controls.Alert;
      import mx.collections.ArrayCollection;

      [Bindable]
      public var myData:ArrayCollection;

      [Bindable]
      public var SupplierID:String;

      [Bindable]
      public var aReturnTypes: Array = [ {label:"query", data:"query"} ];

      [Bindable]
      public var returnType:String="string";

      public function clearAll():void{

      myData=new ArrayCollection();
      }

      public function handleQueryResult(event:ResultEvent):void{
      myData=event.result as ArrayCollection;
      myData.filterFunction=processFilter;
      }

      public function processFilter(item:Object):Boolean
      {
      var result:Boolean=false;
      var pattern:RegExp= new RegExp("^"+txtFilter.text,"i");
      if (!item.PDES5W.length
      || item.PDES5W.match(pattern))
      result=true;

      return result;
      }

      [Bindable]
      public var myfilter: Array = [ {label:"Description", data:"PDES5W"},
      {label:"Product ID", data:"PNUM5W"}, {label:"Size", data:"SDIVDE"}, {label:"Pack", data:"ISCF3W"}, {label:"Rank", data:"DIVN5W"} ];

      [Bindable]
      public var selectedItem:Object;

      private function initVars() : void {
      SupplierID = Application.application.parameters.SupplierID;
      }

      private function gotoURL() : void {
      var url:URLRequest = new URLRequest(" http://www.youngsmarket.com/youngsmarket/programs/inventory/Inventory.cfm?SupplierID="+App lication.application.parameters.SupplierID);
      navigateToURL(url);
      }

      ]]>
      </mx:Script>

      <mx:RemoteObject
      id="qResult"
      destination="ColdFusion"
      source="Inventory"
      showBusyCursor="true" >

      <mx:method name="Inventory" result="handleQueryResult(event)" fault="Alert.show(event.fault.message)"/>
      <mx:method name="SupplierID">
      <mx:arguments>
      <supplierid>
      {Application.application.parameters.SupplierID}
      </supplierid>
      </mx:arguments>
      </mx:method>
      </mx:RemoteObject>

      <mx:Panel title="Inventory" height="90%" width="100%"
      paddingTop="5" paddingLeft="5" paddingRight="5" paddingBottom="5" cornerRadius="10" roundedBottomCorners="true">


      <mx:HBox width="100%">
      <mx:Label text="Filter:"/>
      <mx:TextInput width="100" id="txtFilter" change="myData.refresh()" />
      <mx:ComboBox id="columnfilter" dataProvider="{myfilter}" width="125"
      close="selectedItem=ComboBox(event.target).selectedItem" />
      <mx:RadioButton label="Warehouse" click="accordion.selectedIndex=0;" selected="true"/>
      <mx:RadioButton label="Cash / Carry" click="accordion.selectedIndex=1;"/>
      <mx:RadioButton label="Storage" click="accordion.selectedIndex=2;"/>
      <mx:Spacer width="100%" height="20"/>
      <mx:LinkButton label="Download" click="gotoURL()" />
      </mx:HBox>

      <mx:Accordion id="accordion" width="100%" height="100%" headerHeight="5">
      <mx:VBox height="100%" >
      <mx:DataGrid dataProvider="{myData}" initialize="qResult.Inventory()" width="100%" height="100%">
      <mx:columns>

      <mx:DataGridColumn dataField="PNUM5W" headerText="Prod ID" width="55"/>
      <mx:DataGridColumn dataField="PDES5W" headerText="Desc" width="163"/>
      <mx:DataGridColumn dataField="SDIVDE" headerText="Size" width="50"/>
      <mx:DataGridColumn dataField="ISCF3W" headerText="Pac" width="35"/>
      <mx:DataGridColumn dataField="DIVN5W" headerText="Rnk" width="35"/>

      <mx:DataGridColumn dataField="INV_11" headerText="Or Inv" width="50"/>
      <mx:DataGridColumn dataField="ORD_11" headerText="Or Ord" width="50"/>
      <mx:DataGridColumn dataField="DAT_11" headerText="Or Due" width="50"/>
      <mx:DataGridColumn dataField="INT_11" headerText="Or InT" width="50"/>

      <mx:DataGridColumn dataField="INV_31" headerText="Ch Inv" width="50"/>
      <mx:DataGridColumn dataField="ORD_31" headerText="Ch Ord" width="50"/>
      <mx:DataGridColumn dataField="DAT_31" headerText="Ch Due" width="50"/>
      <mx:DataGridColumn dataField="INT_31" headerText="Ch InT" width="50"/>

      <mx:DataGridColumn dataField="INV_41" headerText="MH Inv" width="50"/>
      <mx:DataGridColumn dataField="ORD_41" headerText="MH Ord" width="50"/>
      <mx:DataGridColumn dataField="DAT_41" headerText="MH Due" width="50"/>
      <mx:DataGridColumn dataField="INT_41" headerText="MH InT" width="50"/>

      </mx:columns>
      </mx:DataGrid>
      </mx:VBox>
      </mx:Accordion>
      </mx:Panel>
      </mx:Application>


      The CFC is here:

      <cfcomponent name="Inventory">
      <cffunction name="Inventory" access="remote" returnType="query" output="false">
      <cfparam name="SupplierID" default="">
      <CFQUERY NAME="Inventory" DATASOURCE="TheDB" maxrows="1000">
      SELECT PNUM5W, PDES5W, SDIVDE, ISCF3W, DIVN5W, COMC5W, COMCDE, PGMJ5W, PGMJDE,
      INV_11, ORD_11, SUBSTRING(DAT_11,4,2) + '/' + SUBSTRING(DAT_11,6,2) AS DAT_11, INT_11,
      INV_21, ORD_21, SUBSTRING(DAT_21,4,2) + '/' + SUBSTRING(DAT_21,6,2) AS DAT_21, INT_21,
      INV_31, ORD_31, SUBSTRING(DAT_31,4,2) + '/' + SUBSTRING(DAT_31,6,2) AS DAT_31, INT_31,
      INV_41, ORD_41, SUBSTRING(DAT_41,4,2) + '/' + SUBSTRING(DAT_41,6,2) AS DAT_41, INT_41,
      INV_51, ORD_51, SUBSTRING(DAT_51,4,2) + '/' + SUBSTRING(DAT_51,6,2) AS DAT_51, INT_51,
      INV_A1, INV_B1, INV_C1, INV_D1, INV_E1
      FROM InvYY
      <cfif #SupplierID# IS NOT ''>
      WHERE PGMJ5W = <cfqueryparam
      value="#arguments.TheDB.SupplierID()#"
      cfsqltype="CF_SQL_INTEGER">
      </cfif>
      ORDER BY PDES5W, SDIVDE, PNUM5W
      </CFQUERY>
      <cfreturn Inventory>
      </cffunction>
      </cfcomponent>

      Thanks George