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

A Quick CFC Help?

Explorer ,
Nov 10, 2008 Nov 10, 2008

Copy link to clipboard

Copied

Hi, I am stuck at one point

I want to know howi can call the one queryvalue into another in a cfc.

like i have one query which counts all the rows and in the next query, i get the value from the above query. i use randtange to get the radom value.

I am able to do it without CFC but when i embedde in cfc i get numerrous issues.

I know it can be done by making the one cfc method private but don't know the exact way around

Can some one guide me plz

Cheers
TOPICS
Advanced techniques

Views

212

Translate

Translate

Report

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 ,
Nov 11, 2008 Nov 11, 2008

Copy link to clipboard

Copied

LATEST
it is not very clear what you mean...
are the 2 queries in the same cfc method or in different methods?

if they are in 2 different methods (functions) of the same cfc, then
just call the first function from the second function to get the result
o the first function into a var:

<cfcomponent>

<cffunction name='f1' returntype='numeric' access='public' output='no'>
<cfset var q1 = ''>
<cfquery name='q1' datasource='...'>
SELECT x FROM y WHERE ...
</cfquery>
<cfreturn q1.recordcount />
</cffunction>

<cffunction name='f2' returntype='numeric' access='public' output='no'>
<cfset var f1q1recordcount = function1()>
<cfreturn f1q1recordcount />
</cffunction>

</cfcomponent>

if function f1 was in a separate cfc, then you just invoke that cfc in
the f2 function via your preferred method, i.e.:

<cffunction name='f2' returntype='numeric' access='public' output='no'>
<cfset objOtherCFC = createobject('component', 'path.to.other.cfc')>
<cfset var f1q1recordcount = objOtherCFC.function1()>
<cfreturn f1q1recordcount />
</cffunction>

hth

Azadi Saryev
Sabai-dee.com
http://www.sabai-dee.com/

Votes

Translate

Translate

Report

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
Documentation