Ask a Question related to Coldfusion - Advanced Techniques, Design and Development.
-
JENS LYNET #1
query of queries inside cffunction
Hi im trying to use the benifits of query of queries, but cannot get it to
work...Im calling a cffunction inside a cfc (mx) from flash.mx here is my code:
Thanx in advance
<cffunction name="getmodel" access="remote" returnType="query">
<cfargument name="maerke" type="string">
<CFQUERY NAME="q_model" Datasource="2004printmore">
SELECT id, model FROM model
WHERE kategori = #maerke#
</CFQUERY>
<cfreturn q_model>
</cffunction>
<cffunction name="querymodel" access="remote" returnType="query">
<cfargument name="id" type="string">
<CFQUERY NAME="model_qq" dbtype="query">
SELECT id, model FROM q_model
WHERE model.id = #id#
</CFQUERY>
<cfreturn model_qq>
</cffunction>
JENS LYNET Guest
-
Need Help with Query of Queries
I have the query "almost" there but I'm not sure exactly how to accomplish this. I need all recrods meeting the criteria from the AppliedLicense... -
query of queries with avg()
cfmx 6.1 when i use avg() in a query of queries it rounds the results (actually rounds results down)...so i'm wondering if i am doing this... -
2 queries to 1 query
Hello, Can somebody help me to combine these two queries into one query. <cfquery datasource="#DATAS#" name="getMainNav"> SELECT * FROM... -
Query of Queries on query New type query
In CF5 we have a page that creates a query, using queryNew and querySetCell and the like, we then used dbtype="query" and gave it's name so we could... -
Query of Queries?
I have a table named therapists with a field named modalities which contains a comma delimited list of id #s. I need to loop through a list of... -
PaulH #2
Re: query of queries inside cffunction
well both WHERE clauses are missing quotes:
WHERE kategori = '#maerke#'
WHERE model.id = '#id#'
and your second function's not getting a query passed into it. though i guess
because you're not scoping your queries these are in the cfc's variables scope.
PaulH Guest
-
JENS LYNET #3
Re: query of queries inside cffunction
Hi Paul I dont need the quotes, i tested that. But what do u mean 'second
function's not getting a query passed into it'? As i read the doc u just need
to use the name of the query that you want to query....
JENS LYNET Guest
-
Adam Cameron #4
Re: query of queries inside cffunction
> <cffunction name="getmodel" access="remote" returnType="query">
Well you're creating this query in this function...> <cfargument name="maerke" type="string">
> <CFQUERY NAME="q_model" Datasource="2004printmore">
> <cffunction name="querymodel" access="remote" returnType="query">
> <cfargument name="id" type="string">
> <CFQUERY NAME="model_qq" dbtype="query">
> SELECT id, model FROM q_model
.... But you're referring to it in this function.
How does querymodel() know about what goes on in getmodel()?
--
Adam
Adam Cameron Guest
-
PaulH #5
Re: query of queries inside cffunction
your function arguments define those as "string".
good practice says that your functions should be 100% isolated from each other
& the application calling them. your second function isn't being passed a query
for it to work on. something like this maybe:
<!--- t.cfc --->
<cfcomponent>
<cffunction name="getData" output="No" returntype="query">
<cfset var q="">
<cfquery name="q" datasource="lab">
SELECT uniText, uniLanguage
FROM unicodeTest
ORDER BY uniLanguage
</cfquery>
<cfreturn q>
</cffunction>
<cffunction name="getSomeData" output="No" returntype="query">
<cfargument name="language" required="Yes" type="string">
<cfargument name="q" required="Yes" type="query">
<cfset var reQ="">
<cfquery name="reQ" dbtype="query">
SELECT uniText
FROM arguments.q
WHERE uniLanguage='#arguments.language#'
</cfquery>
<cfreturn reQ>
</cffunction>
</cfcomponent>
<!--- t.cfm --->
<cfscript>
q=createObject("component","t");
aQuery=q.getData();
b=q.getSomeData("Arabic",aQuery);
</cfscript>
<cfdump var="#b#">
PaulH Guest



Reply With Quote

