Can't help you there never had issues using #arguments.xyz# in queries (MySQL). Don't understand the <cfoutput>. This is a server-side call, your only output is a data query object. I never use cfouput in any of my server-side code called by ajax.
--- On Wed, 11/11/09, onomo joel <joelonomo@...> wrote:
From: onomo joel <joelonomo@...> Subject: Re : Re : Re : Re : [cfajax] cfajax+dbqueries To: cfajax@yahoogroups.com Date: Wednesday, November 11, 2009, 8:05 AM
Sorry, but i forgot the cfouput around the cfscript. Now it works only when i put static values in the query. When i use #arguments.year# ..... it doesn't work. What's wrong with #arguments.values# as filter of the query?
I solved the problem with the database, but it looks like the results of the cfquery are not copied in the QueryNew. I don't know why. Thank you This is the code:
SELECT DATEPART(year, sdate) as yeardate, DATEPART(month, sdate) as monthdate, count(suse) as result, suse FROM TBL_imgusage GROUP BY DATEPART(year, sdate), DATEPART(month, sdate), suse HAVING DATEPART(year, sdate) = #arguments.annee# AND DATEPART(month, sdate)= '#arguments. mois#' AND suse = '#arguments. usage#';
</cfquery>
Good morning, When i do that, i have a message saying that WorkQuery.result is undefined. Also, i think that my query doesn't return any result and i don't know. I think the problem is coming from there, because when i go on the firebug response, the query has no value after execution. I am using that query on Sql Server. If you know Sql Server, i would be glad to receive your help on that cfquery. Thank you for all
--- On Tue, 11/10/09, onomo joel <joelonomo@yahoo. fr> wrote:
From: onomo joel <joelonomo@yahoo. fr> Subject: Re : Re : [cfajax] cfajax+dbqueries To: cfajax@yahoogroups. com Date: Tuesday, November 10, 2009, 11:15 AM
Right now i have void results, but the post has the right values. When i check response with firebug, all the queries column are there but they are void. and on the page to be displayed i have the message: undefined.
<!---<cfif isDefined(#argument s.mois#) AND
isDefined(#argument s.annee#) AND isDefined(#argument s.usage#)> --->
<cfquery name="Qresult" datasource=" kpimage" >
SELECT DATENAME(year, sdate) as yeardate, DATENAME(month, sdate) as monthdate, count(suse) as result, suse FROM dbo.TBL_imgusage GROUP BY DATENAME(year, sdate), DATENAME(month, sdate), suse HAVING (DATENAME(year, sdate) = '#arguments. annee#') AND (DATENAME(month, sdate)= '#arguments.
mois#') AND (suse = '#arguments. usage#'); </cfquery>
function loadInfo() { var mois = DWRUtil.getValue( "mois"); var annee = DWRUtil.getValue( "annee"); var usage = DWRUtil.getValue( "usage"); DWREngine._execute( _cfscriptLocatio n, null, 'statistics' , mois, annee, usage, getResultData)
;
}
function getResultData( WorkQuery) { document.getElement ById("info" ).innerHTML =WorkQuery[0] .result;
<strong><em><u>Overall Number of Hits:</u></em></strong><cfoutput query="totalhits"><em style="color: ##F60"> #hits#</em></cfoutput> </p>
<p align="center" style="font- size:18px"> </p> <p
align="center" style="font- size:18px"><strong>You Can Apply The Filters Below According To Your Search</strong>...</p> <p align="center" style="font- size:18px"> </p> <p align="center"></p>
Sorry, but i forgot the cfouput around the cfscript. Now it works only when i put static values in the query. When i use #arguments.year#..... it doesn't work. What's wrong with #arguments.values# as filter of the query?
De :
onomo joel <joelonomo@...> À : cfajax@yahoogroups.com Envoyé le : Mer 11 Novembre 2009, 10 h 22 min 30 s Objet : Re : Re : Re : [cfajax] cfajax+dbqueries
I solved the problem with the database, but it looks like the results of the cfquery are not copied in the QueryNew. I don't know why. Thank you This is the code:
SELECT DATEPART(year, sdate) as yeardate, DATEPART(month, sdate) as monthdate, count(suse) as result, suse FROM TBL_imgusage GROUP BY DATEPART(year, sdate), DATEPART(month, sdate), suse HAVING DATEPART(year, sdate) = #arguments.annee# AND DATEPART(month, sdate)= '#arguments.mois#' AND suse = '#arguments.usage#';
</cfquery>
I solved the problem with the database, but it looks like the results of the cfquery are not copied in the QueryNew. I don't know why. Thank you This is the code:
SELECT DATEPART(year, sdate) as yeardate, DATEPART(month, sdate) as monthdate, count(suse) as result, suse FROM TBL_imgusage GROUP BY DATEPART(year, sdate), DATEPART(month, sdate), suse HAVING DATEPART(year, sdate) = #arguments.annee# AND DATEPART(month, sdate)= '#arguments.mois#' AND suse = '#arguments.usage#';
</cfquery>
--- On Tue, 11/10/09, onomo joel <joelonomo@...> wrote:
From: onomo joel <joelonomo@...> Subject: Re : Re : [cfajax] cfajax+dbqueries To: cfajax@yahoogroups.com Date: Tuesday, November 10, 2009, 11:15 AM
Right now i have void results, but the post has the right values. When i check response with firebug, all the queries column are there but they are void. and on the page to be displayed i have the message: undefined.
<!---<cfif isDefined(#argument s.mois#) AND
isDefined(#argument s.annee#) AND isDefined(#argument s.usage#)> --->
<cfquery name="Qresult" datasource=" kpimage" >
SELECT DATENAME(year, sdate) as yeardate, DATENAME(month, sdate) as monthdate, count(suse) as result, suse FROM dbo.TBL_imgusage GROUP BY DATENAME(year, sdate), DATENAME(month, sdate), suse HAVING (DATENAME(year, sdate) = '#arguments. annee#') AND (DATENAME(month, sdate)= '#arguments.
mois#') AND (suse = '#arguments. usage#'); </cfquery>
function loadInfo() { var mois = DWRUtil.getValue( "mois"); var annee = DWRUtil.getValue( "annee"); var usage = DWRUtil.getValue( "usage"); DWREngine._execute( _cfscriptLocatio n, null, 'statistics' , mois, annee, usage, getResultData)
;
}
function getResultData( WorkQuery) { document.getElement ById("info" ).innerHTML =WorkQuery[0] .result;
<strong><em><u>Overall Number of Hits:</u></em></strong><cfoutput query="totalhits"><em style="color: ##F60"> #hits#</em></cfoutput> </p>
<p align="center" style="font- size:18px"> </p> <p
align="center" style="font- size:18px"><strong>You Can Apply The Filters Below According To Your Search</strong>...</p> <p align="center" style="font- size:18px"> </p> <p align="center"></p>
Right now i have void results, but the post has the right values. When i check response with firebug, all the queries column are there but they are void. and on the page to be displayed i have the message: undefined.
<!---<cfif isDefined(#arguments.mois#) AND isDefined(#arguments.annee#) AND isDefined(#arguments.usage#)> --->
<cfquery name="Qresult" datasource="kpimage" >
SELECT DATENAME(year, sdate) as yeardate, DATENAME(month, sdate) as monthdate, count(suse) as result, suse FROM dbo.TBL_imgusage GROUP BY DATENAME(year, sdate), DATENAME(month, sdate), suse HAVING (DATENAME(year, sdate) =
'#arguments.annee#') AND (DATENAME(month, sdate)= '#arguments.mois#') AND (suse = '#arguments.usage#'); </cfquery>
function loadInfo() { var mois = DWRUtil.getValue("mois"); var annee = DWRUtil.getValue("annee"); var usage = DWRUtil.getValue("usage");
DWREngine._execute(_cfscriptLocation, null, 'statistics', mois, annee, usage, getResultData);
}
function getResultData( WorkQuery) { document.getElementById("info").innerHTML =WorkQuery[0].result;
}
function init() { DWRUtil.useLoadingMessage(); DWREngine._errorHandler = errorHandler; loadInfo(); }
<strong><em><u>Overall Number of Hits:</u></em></strong><cfoutput query="totalhits"><em style="color:##F60"> #hits#</em></cfoutput> </p>
<p align="center"
style="font-size:18px"> </p> <p align="center" style="font-size:18px"><strong>You Can Apply The Filters Below According To Your Search</strong>...</p> <p align="center" style="font-size:18px"> </p> <p align="center"></p>
I not longer use CFajax, I use ajaxCFC, this is a different ajax coldfusion project. ajaxCFC has some quick ways of building tables, selects etc using your returned query object.
However, if you have a field named xyz in your returned query object, then you could reference that field value DataQuery.xyz[0]. or something like var returnxyz = DataQuery.xyz[0]. If you return more than one record in your query you can set up a for loop in javascript to access each record in the query array. In the example below I'm returning only one record.
function getData () { DWREngine._execute(_ajaxConfig._cfscriptLocation, null, 'getWorkClientData', companynojs, workidjs, loadData);}
--- On Tue, 11/10/09, onomo joel <joelonomo@...> wrote:
From: onomo joel <joelonomo@...> Subject: Re : [cfajax] cfajax+dbqueries To: cfajax@yahoogroups.com Date: Tuesday, November 10, 2009, 9:01 AM
Thank you for your answer, Please can i have an example where to access to those values in the javascript function to be called by DWREngine._execute? Thank you
--- On Tue, 11/10/09, onomo <joelonomo@yahoo. fr> wrote:
From: onomo <joelonomo@yahoo. fr> Subject: [cfajax] cfajax+dbqueries To: cfajax@yahoogroups. com Date: Tuesday, November 10, 2009, 7:10 AM
Hi everybody,
I am trying to use cfajax to load a content from a database. I have been inpired by this web site:http://www.bifrost. com.au/blog/ index.cfm/ 2006/7/13/ CFAJAX-Suggest All i have in my execution are the loading messages. I also use firebug to see if my post and response are good for the functions.cfm. , the post has the good values but the response doesn't display anything. I don't know what to do now to make it work. I will be glad to receive your help. Thank you
code: // functions.cfm
<!--- Function that returns statistic results according to a year/month/usage --->
<cfif isDefined(arguments .mois) AND isDefined(arguments .annee) AND isDefined(arguments .usage)>
<cfquery name="Qresult" datasource=" kpimage">
SELECT DATENAME(year, sdate) as yeardate, DATENAME(month, sdate) as monthdate, count(suse) as result, suse FROM TBL_imgusage GROUP BY DATENAME(year,
sdate), DATENAME(month, sdate), suse HAVING (DATENAME(year, sdate) = arguments.annee) AND (DATENAME(month, sdate)= arguments.mois) AND (suse = arguments.usage) </cfquery>
<cfreturn Qresult>
</cfif>
<cfif isDefined(arguments
.annee) AND isDefined(arguments .usage)>
<cfquery name="Qresult" datasource=" kpimage"> SELECT DATENAME(year, sdate) as yeardate,count( suse) as result, suse FROM TBL_imgusage GROUP BY DATENAME(year, sdate), suse HAVING (DATENAME(year, sdate) = <cfqueryparam cfsqltype="cf_ sql_integer" value="#arguments. annee#">) AND (suse = <cfqueryparam cfsqltype="cf_ sql_varchar" value="#arguments. usage#">);
</cfquery> <!--- <cfset result = queryyear.result> ---> <cfreturn Qresult>
</cfif>
<cfif isDefined(arguments .usage)> <cfquery name="Qresult" datasource=" kpimage"> SELECT count(suse) as result, suse FROM TBL_imgusage GROUP BY suse HAVING
(suse = <cfqueryparam cfsqltype="cf_ sql_varchar" value="#arguments. usage#">); </cfquery> <!--- <cfset result = queryyear.result> ---> <cfreturn Qresult>
function loadInfo() { var mois = DWRUtil.getValue( "mois"); var annee = DWRUtil.getValue( "annee"); var usage = DWRUtil.getValue( "usage");
DWREngine._execute( _cfscriptLocatio n, null, 'statistics' , mois, annee, usage, getResultData) ;
}
function getResultData( Qresult) { document.getElement ById("info" ).innerHTML =Qresult[0]. RESULT ; }
<strong><em><u>Overall Number of Hits:</u></em></strong><cfoutput query="totalhits"><em style="color: ##F60"> #hits#</em></cfoutput> </p>
<p align="center" style="font-
size:18px"> </p> <p align="center" style="font- size:18px"><strong>You Can Apply The Filters Below According To Your Search</strong>...</p> <p align="center" style="font- size:18px"> </p> <p align="center"></p>
Thank you for your answer, Please can i have an example where to access to those values in the javascript function to be called by DWREngine._execute? Thank you
--- On Tue, 11/10/09, onomo <joelonomo@yahoo. fr> wrote:
From: onomo <joelonomo@yahoo. fr> Subject: [cfajax] cfajax+dbqueries To: cfajax@yahoogroups. com Date: Tuesday, November 10, 2009, 7:10 AM
Hi everybody,
I am trying to use cfajax to load a content from a database. I have been inpired by this web site:http://www.bifrost. com.au/blog/ index.cfm/ 2006/7/13/ CFAJAX-Suggest All i have in my execution are the loading messages. I also use firebug to see if my post and response are good for the functions.cfm. , the post has the good values but the response doesn't display anything. I don't know what to do now to make it work. I will be glad to receive your help. Thank you
code: // functions.cfm
<!--- Function that returns statistic results according to a year/month/usage --->
<cfif isDefined(arguments .mois) AND isDefined(arguments .annee) AND isDefined(arguments .usage)>
<cfquery name="Qresult" datasource=" kpimage">
SELECT DATENAME(year, sdate) as yeardate, DATENAME(month, sdate) as monthdate, count(suse) as result, suse FROM TBL_imgusage GROUP BY DATENAME(year,
sdate), DATENAME(month, sdate), suse HAVING (DATENAME(year, sdate) = arguments.annee) AND (DATENAME(month, sdate)= arguments.mois) AND (suse = arguments.usage) </cfquery>
<cfreturn Qresult>
</cfif>
<cfif isDefined(arguments
.annee) AND isDefined(arguments .usage)>
<cfquery name="Qresult" datasource=" kpimage"> SELECT DATENAME(year, sdate) as yeardate,count( suse) as result, suse FROM TBL_imgusage GROUP BY DATENAME(year, sdate), suse HAVING (DATENAME(year, sdate) = <cfqueryparam cfsqltype="cf_ sql_integer" value="#arguments. annee#">) AND (suse = <cfqueryparam cfsqltype="cf_ sql_varchar" value="#arguments. usage#">);
</cfquery> <!--- <cfset result = queryyear.result> ---> <cfreturn Qresult>
</cfif>
<cfif isDefined(arguments .usage)> <cfquery name="Qresult" datasource=" kpimage"> SELECT count(suse) as result, suse FROM TBL_imgusage GROUP BY suse HAVING
(suse = <cfqueryparam cfsqltype="cf_ sql_varchar" value="#arguments. usage#">); </cfquery> <!--- <cfset result = queryyear.result> ---> <cfreturn Qresult>
function loadInfo() { var mois = DWRUtil.getValue( "mois"); var annee = DWRUtil.getValue( "annee"); var usage = DWRUtil.getValue( "usage");
DWREngine._execute( _cfscriptLocatio n, null, 'statistics' , mois, annee, usage, getResultData) ;
}
function getResultData( Qresult) { document.getElement ById("info" ).innerHTML =Qresult[0]. RESULT ; }
<strong><em><u>Overall Number of Hits:</u></em></strong><cfoutput query="totalhits"><em style="color: ##F60"> #hits#</em></cfoutput> </p>
<p align="center" style="font-
size:18px"> </p> <p align="center" style="font- size:18px"><strong>You Can Apply The Filters Below According To Your Search</strong>...</p> <p align="center" style="font- size:18px"> </p> <p align="center"></p>
--- On Tue, 11/10/09, onomo <joelonomo@...> wrote:
From: onomo <joelonomo@...> Subject: [cfajax] cfajax+dbqueries To: cfajax@yahoogroups.com Date: Tuesday, November 10, 2009, 7:10 AM
Hi everybody,
I am trying to use cfajax to load a content from a database. I have been inpired by this web site:http://www.bifrost. com.au/blog/ index.cfm/ 2006/7/13/ CFAJAX-Suggest All i have in my execution are the loading messages. I also use firebug to see if my post and response are good for the functions.cfm. , the post has the good values but the response doesn't display anything. I don't know what to do now to make it work. I will be glad to receive your help. Thank you
code: // functions.cfm
<!--- Function that returns statistic results according to a year/month/usage --->
<cfif isDefined(arguments .mois) AND isDefined(arguments .annee) AND isDefined(arguments .usage)>
<cfquery name="Qresult" datasource=" kpimage">
SELECT DATENAME(year, sdate) as yeardate, DATENAME(month, sdate) as monthdate, count(suse) as result, suse FROM TBL_imgusage GROUP BY DATENAME(year,
sdate), DATENAME(month, sdate), suse HAVING (DATENAME(year, sdate) = arguments.annee) AND (DATENAME(month, sdate)= arguments.mois) AND (suse = arguments.usage) </cfquery>
<cfreturn Qresult>
</cfif>
<cfif isDefined(arguments
.annee) AND isDefined(arguments .usage)>
<cfquery name="Qresult" datasource=" kpimage"> SELECT DATENAME(year, sdate) as yeardate,count( suse) as result, suse FROM TBL_imgusage GROUP BY DATENAME(year, sdate), suse HAVING (DATENAME(year, sdate) = <cfqueryparam cfsqltype="cf_ sql_integer" value="#arguments. annee#">) AND (suse = <cfqueryparam cfsqltype="cf_ sql_varchar" value="#arguments. usage#">);
</cfquery> <!--- <cfset result = queryyear.result> ---> <cfreturn Qresult>
</cfif>
<cfif isDefined(arguments .usage)> <cfquery name="Qresult" datasource=" kpimage"> SELECT count(suse) as result, suse FROM TBL_imgusage GROUP BY suse HAVING
(suse = <cfqueryparam cfsqltype="cf_ sql_varchar" value="#arguments. usage#">); </cfquery> <!--- <cfset result = queryyear.result> ---> <cfreturn Qresult>
</cfif>
</cffunction>
// index.cfm
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional/ /EN" "http://www. w3.org/TR/ html4/loose. dtd"> <html> <head> <title>BUGWOOD IMAGES STATISTICS</title>
function loadInfo() { var mois = DWRUtil.getValue( "mois"); var annee = DWRUtil.getValue( "annee"); var usage = DWRUtil.getValue( "usage");
DWREngine._execute( _cfscriptLocatio n, null, 'statistics' , mois, annee, usage, getResultData) ;
}
function getResultData( Qresult) { document.getElement ById("info" ).innerHTML =Qresult[0]. RESULT ; }
<strong><em><u>Overall Number of Hits:</u></em></strong><cfoutput query="totalhits"><em style="color: ##F60"> #hits#</em></cfoutput> </p>
<p align="center" style="font-
size:18px"> </p> <p align="center" style="font- size:18px"><strong>You Can Apply The Filters Below According To Your Search</strong>...</p> <p align="center" style="font- size:18px"> </p> <p align="center"></p>
I am trying to use cfajax to load a content from a database. I have been inpired by this web site:http://www.bifrost.com.au/blog/index.cfm/2006/7/13/CFAJAX-Suggest All
i have in my execution are the loading messages. I also use firebug to
see if my post and response are good for the functions.cfm., the post
has the good values but the response doesn't display anything. I don't
know what to do now to make it work. I will be glad to receive your
help. Thank you
code: // functions.cfm
<!--- Function that returns statistic results according to a year/month/usage --->
<cfif isDefined(arguments.mois) AND isDefined(arguments.annee) AND isDefined(arguments.usage)>
<cfquery name="Qresult" datasource="kpimage">
SELECT DATENAME(year, sdate) as yeardate, DATENAME(month, sdate) as monthdate, count(suse) as result, suse FROM TBL_imgusage GROUP BY DATENAME(year, sdate), DATENAME(month, sdate), suse HAVING (DATENAME(year, sdate) = arguments.annee) AND (DATENAME(month, sdate)= arguments.mois) AND (suse = arguments.usage) </cfquery>
<cfreturn Qresult>
</cfif>
<cfif isDefined(arguments.annee) AND isDefined(arguments.usage)>
<cfquery name="Qresult" datasource="kpimage"> SELECT DATENAME(year, sdate) as yeardate,count(suse) as result, suse FROM TBL_imgusage GROUP BY DATENAME(year, sdate), suse HAVING (DATENAME(year, sdate) = <cfqueryparam cfsqltype="cf_sql_integer" value="#arguments.annee#">) AND (suse = <cfqueryparam cfsqltype="cf_sql_varchar" value="#arguments.usage#">); </cfquery> <!--- <cfset result = queryyear.result> ---> <cfreturn Qresult>
</cfif>
<cfif isDefined(arguments.usage)> <cfquery name="Qresult" datasource="kpimage"> SELECT count(suse) as result, suse FROM TBL_imgusage GROUP BY suse HAVING (suse = <cfqueryparam cfsqltype="cf_sql_varchar" value="#arguments.usage#">); </cfquery> <!--- <cfset result = queryyear.result> ---> <cfreturn Qresult>
</cfif>
</cffunction>
// index.cfm
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <title>BUGWOOD IMAGES STATISTICS</title>
function loadInfo() { var mois = DWRUtil.getValue("mois"); var annee = DWRUtil.getValue("annee"); var usage = DWRUtil.getValue("usage"); DWREngine._execute(_cfscriptLocation, null, 'statistics', mois, annee, usage, getResultData);
}
function getResultData(Qresult) { document.getElementById("info").innerHTML =Qresult[0].RESULT ; }
function init() { DWRUtil.useLoadingMessage(); DWREngine._errorHandler = errorHandler; loadInfo(); }
<strong><em><u>Overall Number of Hits:</u></em></strong><cfoutput query="totalhits"><em style="color:##F60"> #hits#</em></cfoutput> </p>
<p align="center" style="font-size:18px"> </p> <p align="center" style="font-size:18px"><strong>You Can Apply The Filters Below According To Your Search</strong>...</p> <p align="center" style="font-size:18px"> </p> <p align="center"></p>
I am trying to use cfajax to load a content from a database. I have been inpired by this web site:http://www.bifrost.com.au/blog/index.cfm/2006/7/13/CFAJAX-Suggest All i have in my execution are the loading messages. I also use firebug to see if my post and response are good for the functions.cfm., the post has the good values but the response doesn't display anything. I don't know what to do now to make it work. I will be glad to receive your help. Thank you
The function's and html files are attached. Thank you for your help
First. it's best to upgrade to mxAjax - cfajax hasn't been updated in
a long time.
Second, try this:
http://www.bifrost.com.au/blog/index.cfm/2006/7/13/Installing-CFAJAX--Paths-expl\
ained
and
http://www.bifrost.com.au/blog/index.cfm/2006/7/13/Getting-the-CFAJAX-Suggest-ex\
amples-to-work-locally
mxAjax / CFAjax docs and other useful articles:
http://www.bifrost.com.au/blog/
2009/7/17 sergio.bonfiglio@... <sergio.bonfiglio@...>:
>
>
> Hello to the community.
> You will probably consider me an ass, but I'm experiencing a very strange
> behaviour.
> If I try to run the examples from the directory where I put the original
> files all works fine.
> If I try to run the examples in the root or in different directories all
> stops working.
> I checked and re-checked the presence of all the files, and they are the
> same.
> But if I put all in the root, everything refuses to work.
> Can you suggest me a strategy to debug to find out what's missing ?
> I'm using a plain cfajax 1.3 without jquery.
>
> Thanks to anyone for any help.
>
> Sergio
>
>