[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Passing CFC components

Posted on 2011-03-07
3
Medium Priority
?
309 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

Sometimes databases have MILLIONS of records and we need a way to quickly query that table to return the results me need. Sure you could use CFQUERY but it takes too long when there are millions of records. That is why SOLR was invented. Please …
Recently while working on a project I got a very annoying cfdocument has no body error message. I had never seen this error before. So I checked the code. The code was pretty simple; it was Just showing me the cfdocumnt tag and inside that tag a …
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …
Suggested Courses

656 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