Need Help with CFINVOKE
BYJ_wntrsnt Feb 11, 2014 9:00 AMI don't usually get this type of error message when using cfinvoke this way (see below) but this time I keep getting this error no matter how I modify my logic or my codes.
I've spent a week trying to find what's going on and could not find the answer. Can anyone help please?
This is the last modification I made with my codes and I still can't get pass this section due to the error message.
This expression must have a constant value.
RowIteration.cfc: line 107
105 : ThisRowNo="#Trim(arguments.ThisRowNo)#"
106 : Camp="#arguments.Campus#"
107 : LYear="#arguments.LYear#">
Here is how my codes, it used to work when I do it this way:
<!--- I'm looping over an array & validate each required array elements --->
<cfset arr_FileContents = ListToArray(list_w_null2,chr(10), true)>
<CFSET var_Count=1>
<cfloop index="i" array="#arr_FileContents#">
<CFSET PipeLine = Replace(i,chr(9),"|", "ALL")>
<CFSET PipeLine = replace( PipeLine, "||", "| |", "all" )>
<CFSET PipeLine = replace( PipeLine, "||", "| |", "all" )>
<CFSET PipeLine = reReplace( PipeLine, "\|$", "| ", "all" )>
<CFSET arr_ThisRow = ListToArray(PipeLine, '|', true)>
<cfinvoke component="MyComp.PComp.CheckRow" method="ValidateRow"
arr="#arr_ThisRow#"
Camp="#Trim(Institution)#"
LYear="#Trim(load_year)#"
ThisRowNo="#Trim(var_Count)#">
<CFSET var_Count=#var_Count#+1>
</cfloop>
<!--- In my cfc --->
<CFCOMPONENT>
<CFFUNCTION name="ValidateRow">
<cfargument name="arr" type="Array" required="TRUE">
<cfargument name="Camp" type="String" required="TRUE">
<cfargument name="LYear" type="String" required="TRUE">
<cfargument name="ThisRowNo" type="Numeric" required="TRUE">
<cfset st_ReqFields=StructNew()>
<cfset st_ReqFields["NameType"]="#Trim(arr[6])#">
<cfset st_ReqFields["PtLN"]="#Trim(arr[7])#">
<cfset st_ReqFields["PtFN"]="#Trim(arr[8])#">
<cfset st_ReqFields["PtPrefix"]="#Trim(arr[10])#">
<cfset st_ReqFields["Sex"]="#Trim(arr[13])#">
<cfset st_ReqFields["PAddr"]="#Trim(arr[19])#">
<CFIF arr[19] EQ "H">
<cfset st_ReqFields["HAddr1"]="#Trim(arr[20])#">
<cfset st_ReqFields["HCity"]="#Trim(arr[23])#">
<cfset st_ReqFields["HState"]="#Trim(arr[24])#">
<cfset st_ReqFields["HZip"]="#Trim(arr[25])#">
<cfset st_ReqFields["HCountry"]="#Trim(arr[26])#">
<cfset st_ReqFields["HPhone"]="#Trim(arr[28])#">
<cfset st_ReqFields["HUnlistedFlag"]="#Trim(arr[29])#">
<CFELSE><!--- arr[19] IS "B" --->
<cfset st_ReqFields["BAddr1"]="#Trim(arr[33])#">
<cfset st_ReqFields["BCity"]="#Trim(arr[36])#">
<cfset st_ReqFields["BState"]="#Trim(arr[37])#">
<cfset st_ReqFields["BZip"]="#Trim(arr[38])#">
<cfset st_ReqFields["BCountry"]="#Trim(arr[39])#">
<cfset st_ReqFields["BPhone"]="#Trim(arr[41])#">
<cfset st_ReqFields["BUnlistedFlag"]="#Trim(arr[42])#">
</CFIF>
<!--- I can't get pass this cfinvoke! I used to be able to invoke other method within cfc and my other apps are still working when I'm doing
it this way. I have never gotten this type of error --->
<CFINVOKE component="MyComp.PComp.ValFields" method="CheckReqFields"
st_ReqFields="#st_ReqFields#"
ThisParent="1"
ThisRowNo="#Trim(arguments.ThisRowNo)#"
Camp="#arguments.Camp#"
LYear="#arguments.LYear#">
</'CFCOMPONENT>
<!--- Other component --->
<CFCOMPONENT><!--- ValFields --->
<CFFUNCTION name="CheckReqFields">
etc...
</CFFUNCTION>
</CFCOMPONENT>


