Solved

Passing CFC components

Posted on 2011-03-07
3
297 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
  • 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 500 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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

This article  is about submitting  form through  ColdFusion.Ajax.submitForm to the action page and send a response back in JSON format which later can be decoded using ColdFusion.JSON.decode. By this way you can avoid the usual page refresh for subm…
Hi, Even though I have created this Tutorial on My personal Blog, Some people might not able to find my website, So here i am posting it again Today, from the topic it is very clear that i will be showing you here the very basic usage of how we …
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

707 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now