Scott,

Although it is not well-formed ColdFusion, you could leave off the
<cfargument> tags altogether.  They are not required.  Then do whatever
logic you want 

<cffunction name="myTest">
        <cfdump var="#arguments#">
        <cfoutput>
                #arguments[1]#<br>
                #arguments[2]#
        </cfoutput>
</cffunction>

<cfset myTest('blah',1)>

You will see a dump of a structure with two keys, and you can access them
like an array.

Dave
-----Original Message-----
From: Scott Stewart [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, August 13, 2008 9:19 AM
To: CF-Talk
Subject: cfarguments... determining which argument to use based on passed
variables

Sorry for the cryptic subject

In a function I have three arguments.

<cfargument name ="person_id"/>
<cfargument name = "list"/>
<cfargument name = "dept_no_search"/>

at any given time only one will be populated, based on the existence of 
a url variable.

and then

<cfif structKeyExists(Arguments,"arguments.person_id") is "Yes">
run queries based on person_id
</cfif>

<cfif structKeyExists(Arguments,"arguments.list") is "Yes">
run queries based on list
</cfif>

etc...

I know I could break the function up into separate functions, and the 
arguments have to be the first items in a function
but is there a simple way to do this..

<cfif IsDefined("url.person_id")>
    <cfargument name ="person_id"/>
<cfelse>
</cfif>

       

-- 
--
Scott Stewart
ColdFusion Developer

Office of Research Information Systems
Research &amp; Economic Development
University of North Carolina at Chapel Hill

Phone:(919)843-2408
Fax: (919)962-3600
Email: [EMAIL PROTECTED]





~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;203748912;27390454;j

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:310918
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

Reply via email to