We help IT Professionals succeed at work.
Get Started

How To Share Query Data Between Two ColdFusion CFCs?

967 Views
Last Modified: 2021-04-21
Hi,

I am creating a CFC called "core_appdata". This CFC will hold the core stored procedures for an application.  Example....

<cfcomponent displayname="core_appdata" hint="I Return Core App Data" output="no">

<cffunction name="getprogram_list">	

      <cfargument name="getstoredproc_input_campaignid" type="string" required="false">
       <cfargument name="getstoredproc_input_filtertestrecs" type="string" required="false">
        <cfargument name="getstoredproc_input_startdate" type="date" required="false">
        <cfargument name="getstoredproc_input_enddate" type="date" required="false">
        <cfargument name="getstoredproc_input_listtypeid" type="string" required="false">
        <cfargument name="getstoredproc_input_listid" type="string" required="false">
        <cfargument name="getstoredproc_input_appenvr" type="string" required="false">
		
		<cfset var rst_getprogram_list ="">
		 ---  stored proc --- 			 
			 <cfstoredproc procedure  = "p_adb_getprogram_list">
			 </cfstoredproc>
		 
		<cfreturn rst_getprogram_list />
	</cffunction>
	
</cfcomponent>  

Open in new window


I would also like to create a CFC called "core_appdata_grids". This CFC would be used to bind to cfgrids and allow paging etc. In a perfect world, this CFC would get its data from the method/function "getprogram_list" in the CFC "core_appdata" above. Example...


<cfcomponent displayname="core_appdata_grids" hint="I Return Core App Data For CFGrids " output="no">

	<cffunction name="getprogram_list_grid">
	
               <cfargument name="page" required="no" />
		<cfargument name="pageSize" required="no" />
		<cfargument name="gridsortcolumn" required="no" />
		<cfargument name="gridsortdirection" required="no" />	
		<cfargument name="getstoredproc_input_campaignid" type="string" required="false">
               <cfargument name="getstoredproc_input_filtertestrecs" type="string" required="false">
               <cfargument name="getstoredproc_input_startdate" type="date" required="false">
               <cfargument name="getstoredproc_input_enddate" type="date" required="false">
               <cfargument name="getstoredproc_input_listtypeid" type="string" required="false">
               <cfargument name="getstoredproc_input_listid" type="string" required="false">
                <cfargument name="getstoredproc_input_appenvr" type="string" required="false">
		
		<cfset var rst_getprogram_list_grid ="">
		 ---  get data --- 			 
		
		
		<cfreturn queryconvertforgrid(rst_getprogram_list_grid, page, pagesize) />
	</cffunction>
	
</cfcomponent>  

Open in new window



Questions:
- Is this possible? If so, how is it done?
- If so is this best practice when working with CFCs?
- If not, what is the best way to share data between CFCs


Thank you in advance for your time in helping me with this question.

DD
Comment
Watch Question
CERTIFIED EXPERT
Commented:
This problem has been solved!
Unlock 2 Answers and 11 Comments.
See Answers
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE