Question
CFARGUMENT help!
I'd like to use the existing function within a component.
Since that function is exactly what I need it would be great if I
don't have to rewrite the same query again and again.
The problem is, that existing CFFUNCTION accept 3 arguments, while my calling page only passing 2 parameters. See the code below:
This is the existing cffunction that I need to use:
<CFFUNCTION Name="getCOF" >
<cfargument name="Type" required="true">
<cfargument name="Client" required="true">
<cfargument name="FiscalYear" required="true">
<cfquery name="getInfo" datasource="#Application.datasource#">
select id ,ins,year,seq,type,name,title
from cfname
where type = <cfqueryparam cfsqltype="CF_SQL_CHAR" value="#Type#" />
and ins = <cfqueryparam cfsqltype="CF_SQL_CHAR" value="#Client#" />
and year=<cfqueryparam cfsqltype="CF_SQL_CHAR" value="#FiscalYear#" />
</cfquery>
<cfreturn getInfo>
</CFFUNCTION>
This is how I call this function within a component:
<cfinvoke component="com.COF" method="getCOF"
Type="U" Client="#u.group#" returnvariable="q_FNInfo">
So, I'm not passing Fiscal Year to the function that is ecpecting argument for FiscalYear.
This function is used by other page where the calling page passing Type, Client and FiscalYear
If I do not pass FiscalYear to this Function I will get error saying the function has an argument called FiscalYear
that is set as required but not passed.
How can I still use the same function when I only passing 2 parameters instead of three, can it be done?
I'm on CF8,Sybase and Unix
Please help, thanks.
The problem is, that existing CFFUNCTION accept 3 arguments, while my calling page only passing 2 parameters. See the code below:
This is the existing cffunction that I need to use:
<CFFUNCTION Name="getCOF" >
<cfargument name="Type" required="true">
<cfargument name="Client" required="true">
<cfargument name="FiscalYear" required="true">
<cfquery name="getInfo" datasource="#Application.datasource#">
select id ,ins,year,seq,type,name,title
from cfname
where type = <cfqueryparam cfsqltype="CF_SQL_CHAR" value="#Type#" />
and ins = <cfqueryparam cfsqltype="CF_SQL_CHAR" value="#Client#" />
and year=<cfqueryparam cfsqltype="CF_SQL_CHAR" value="#FiscalYear#" />
</cfquery>
<cfreturn getInfo>
</CFFUNCTION>
This is how I call this function within a component:
<cfinvoke component="com.COF" method="getCOF"
Type="U" Client="#u.group#" returnvariable="q_FNInfo">
So, I'm not passing Fiscal Year to the function that is ecpecting argument for FiscalYear.
This function is used by other page where the calling page passing Type, Client and FiscalYear
If I do not pass FiscalYear to this Function I will get error saying the function has an argument called FiscalYear
that is set as required but not passed.
How can I still use the same function when I only passing 2 parameters instead of three, can it be done?
I'm on CF8,Sybase and Unix
Please help, thanks.
