?
Solved

Passing CFC components

Posted on 2011-03-07
3
Medium Priority
?
303 Views
Last Modified: 2012-05-11
I have  a component which I am calling and this has an argument called jetId which is not required.
The idea is that if I pass a jet Id the query excludes it.
The code then does <cfif isDefined("jetID")> Jet id is being found even when I don't pass the argument because there is a variable called jetid contained on the cfm page which is invoking the component.

Is there a way that allows an argument name to be the same as a variable?
0
Comment
Question by:Lmillard
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 

Author Comment

by:Lmillard
ID: 35066737
sorry, forgot to add code
cfm page invoking the component.


<cfinvoke component="#application.compPath#Jets" method="allJets"
    	returnvariable="allJets">



 the component function


<cfcomponent>
	<cffunction name="allJets" access="public" returntype="query">
		<cfargument name="jetId" type="numeric" required="no">
           
        <cfquery name="allJets" datasource="#application.dataDsn#">
        SELECT 
        jets.*,
        jetCat.catDesc,
        manufacturer.company 
        FROM Jets 
        INNER JOIN jetCat 
        ON jetCat.catID = jets.catID
        INNER JOIN Manufacturer 
        ON jets.manId = manufacturer.manId 
        WHERE status = 1 
        <cfif isDefined("jetID")>
        AND jetID <> #jetID#
        </cfif>
        ORDER BY jets.jetDesc
        </cfquery>
        

		<cfreturn allJets>
	</cffunction>
</cfcomponent>

Open in new window

0
 
LVL 18

Accepted Solution

by:
Plucka earned 2000 total points
ID: 35066950
variables.jetId is the variable

arguments.jetId is the argument

if you use the scopes it should work.
0
 

Author Closing Comment

by:Lmillard
ID: 35067055
Worked perfectly, thanks very much.
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

PROBLEM:  How to open a cfwindow or run a function on double click of a cfgrid row. One of my clients wanted to be able to double click on a row item to get more detailed information about a transaction and to be able to modify the line items i…
PROBLEM: How to add your own buttons to the bottom toolbar with paging info ( result count ). While creating a cfgrid, I ran into an issue where I wanted to embed my own custom buttons where the default ones ( insert / delete / etc… ) are for aes…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question