Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Arguments being passed to CFC

Participant ,
Apr 17, 2009 Apr 17, 2009

Hello Community!

I am using a CFC and I am passing arguments to it. If the argument X -for example-  exists then I set the X variable to the X argument. My program is complaining that they argument doesn't exist. I am verifying that the argument being passed exists and it's correct (I outputted it) however when the value reaches the CFC it says it doesn't exist. Any thoughts?

This is the code where I am invoking the arguments:

<cfinvoke component="cfc.cartSelection" method="#meth#">
             <cfif isDefined("oth_ihdnum") and isDefined("is_bg") and (is_bg eq "G" or is_bg eq "g")>
                 <cfoutput>#oth_ihdnum#</cfoutput>
                 <cfquery datasource="famjdbc" name="othqty">
                        select ordq from ws_cart where ihdnum = '#oth_ihdnum#' and (cookie = '#cookie.user_id#'<cfif isDefined("session.RealCust.custnum")> or custnum = '#session.RealCust.custnum#'</cfif>) and is_bg != 'G' and itemtype IN ('A','B','S')
                    </cfquery>
                 <cfinvokeargument name="qty" value="#othqty.ordq#">
                <cfelse>
                 <cfinvokeargument name="qty" value="#qty#">
                </cfif>
                <cfinvokeargument name="inum" value="#ihdnum#">
              
    <cfif isDefined("is_bg") and is_bg neq "">
                 <cfinvokeargument name="is_bg" value="#is_bg#">
                </cfif>
                <cfif isDefined("price") and price neq "">
                 <cfinvokeargument name="price" value="#price#">
                </cfif>
                <cfif isDefined("oth_ihdnum") and oth_ihdnum neq "">
                 <cfinvokeargument name="oth_ihdnum" value="#oth_ihdnum#">
                </cfif>
            </cfinvoke>
   <cfcatch type="any">
    <cfoutput>
     #cfcatch.Type#<br/>
     #cfcatch.Message#<br/>
     #cfcatch.Detail#<br/>
    </cfoutput>
   </cfcatch>
   </cftry>
            <cfinvoke component="cfc.cartSelection" method="autoUpsell"></cfinvoke>

And this is the code where I am using the argument in the CFC:

<cffunction access="public" name="automaticCart" output="true" returntype="any" hint="This function encapsulates the code that belonged to the file cart_automatic.cfm">

<cfargument name="inum" type="numeric" required="no">
<cfargument name="qty" type="numeric" required="no">
<cfargument name="newqty" type="numeric" required="no">
<cfargument name="is_bg" type="String" required="no" default="N">
<cfargument name="price" type="numeric" required="no">
<cfargument name="oth_ihdnum" type="String" required="no">

<cfif StructkeyExists(arguments,"inum")>
<cfset inum = #arguments.inum#>
</cfif>
<!---<cfdump var="#arguments.is_bg#">--->
<cfif isDefined("arguments.is_bg")>
<!---<cfif StructKeyExists(arguments,"is_bg")>--->
<cfset variables.is_bg = #arguments.is_bg#>
<cfelse>
<cfset variables.is_bg = "N">
</cfif>

And so on.......

Thanks!

Ysais.

TOPICS
Advanced techniques
653
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Apr 17, 2009 Apr 17, 2009
LATEST

Inside your function, right after your cfargument tags, cfdump the arguments scope.  That will tell you for sure what arguments your function can see.  Make sure you do this in the correct function, given that it's a variable in your cfinvoke tag.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources