URL / RemoteObject / CFC
i have this:
http://www.youngsmarket.com/youngsmarket/programs/inventory/inventory/bin/inventory.swf?su pplierid=30
if press download on upper right supplierid gets sent cfm page loads in excel. part works , gets suppliers equal 30
the data comes in initialy grid of data. dont want though. problem. need supplierid go remoteobject , sent along cfc. cannot syntax right this. bellow of code app , below cfc. can show me wrong remoteobject statement. , cfc should receive 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 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 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) dat_11, int_11,
inv_21, ord_21, substring(dat_21,4,2) + '/' + substring(dat_21,6,2) dat_21, int_21,
inv_31, ord_31, substring(dat_31,4,2) + '/' + substring(dat_31,6,2) dat_31, int_31,
inv_41, ord_41, substring(dat_41,4,2) + '/' + substring(dat_41,6,2) dat_41, int_41,
inv_51, ord_51, substring(dat_51,4,2) + '/' + substring(dat_51,6,2) dat_51, int_51,
inv_a1, inv_b1, inv_c1, inv_d1, inv_e1
invyy
<cfif #supplierid# not ''>
pgmj5w = <cfqueryparam
value="#arguments.thedb.supplierid()#"
cfsqltype="cf_sql_integer">
</cfif>
order pdes5w, sdivde, pnum5w
</cfquery>
<cfreturn inventory>
</cffunction>
</cfcomponent>
thanks george
http://www.youngsmarket.com/youngsmarket/programs/inventory/inventory/bin/inventory.swf?su pplierid=30
if press download on upper right supplierid gets sent cfm page loads in excel. part works , gets suppliers equal 30
the data comes in initialy grid of data. dont want though. problem. need supplierid go remoteobject , sent along cfc. cannot syntax right this. bellow of code app , below cfc. can show me wrong remoteobject statement. , cfc should receive 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 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 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) dat_11, int_11,
inv_21, ord_21, substring(dat_21,4,2) + '/' + substring(dat_21,6,2) dat_21, int_21,
inv_31, ord_31, substring(dat_31,4,2) + '/' + substring(dat_31,6,2) dat_31, int_31,
inv_41, ord_41, substring(dat_41,4,2) + '/' + substring(dat_41,6,2) dat_41, int_41,
inv_51, ord_51, substring(dat_51,4,2) + '/' + substring(dat_51,6,2) dat_51, int_51,
inv_a1, inv_b1, inv_c1, inv_d1, inv_e1
invyy
<cfif #supplierid# not ''>
pgmj5w = <cfqueryparam
value="#arguments.thedb.supplierid()#"
cfsqltype="cf_sql_integer">
</cfif>
order pdes5w, sdivde, pnum5w
</cfquery>
<cfreturn inventory>
</cffunction>
</cfcomponent>
thanks george
More discussions in Flex (Read Only)
adobe
Comments
Post a Comment