Issue while populating JSON data to Jquery datatable in ColdFusion - coldfusion

I'm using coldFusion 2016 and I'm facing one issue when I'm putting json data to my Jquery datatable. The datatable is only showing processing message.
The JSON result seems to be error free but i don't know what is the issue.
Here is my datatable implementation
<head>
<script src="https://code.jquery.com/jquery-1.12.4.js"></script>
<script src="https://cdn.datatables.net/1.10.16/js/jquery.dataTables.min.js"></script>
<link href="https://cdn.datatables.net/1.10.16/css/jquery.dataTables.min.css" rel="stylesheet">
<script type="text/javascript">
var table = '';
$(document).ready(function() {
table = $('#example').DataTable( {
"bProcessing": true,
"bServerSide": true,
"ajax": "uploadProcess.cfc?method=getDetails&partyId=100004",
"sPaginationType": "full_numbers",
"oLanguage": {
"sProcessing": "Wait please...",
"sZeroRecords": "No records found.",
"sInfo": "Users from _START_ to _END_ of _TOTAL_ total",
"sInfoEmpty": "Users from 0 to 0 of 0 total"
},
"aoColumns": [
{ "data": "ID" },
{ "data": "ORG_NAME" },
{ "data": "TYPE" },
{ "data": "PATH" },
{ "data": "URL" },
{ "data": "DELETE" }
]
});
});
</script>
</head>
<body>
<div id="dataDiv">
<table id="example" class="display" cellspacing="0" width="100%">
<thead>
<tr>
<th>Id</th>
<th>File Name</th>
<th>Type</th>
<th>Path</th>
<th>Preview</th>
<th>Delete</th>
</tr>
</thead>
</table>
</div>
</body>
Here is my uploadProcess.cfc
<cfcomponent>
<cffunction name="getDetails" access="remote" returnFormat="json">
<cfargument name="partyId" type="string" required="yes">
<cfparam name="arguments.iDisplayStart" default="0">
<cfparam name="arguments.iDisplayLength" default="10">
<cfparam name="arguments.iSortCol_0" default="UploadFileID">
<cfparam name="arguments.sSortDir_0" default="ASC">
<cfparam name="arguments.sEcho" default="1">
<cfstoredproc procedure="get_upload_file_details" datasource="standout">
<cfprocparam value="#partyId#" cfsqltype="CF_SQL_INT">
<cfprocparam value="#arguments.iDisplayStart#" cfsqltype="CF_SQL_INT">
<cfprocparam value="#arguments.iDisplayLength#" cfsqltype="CF_SQL_INT">
<cfprocparam value="#arguments.iSortCol_0#" cfsqltype="CF_SQL_VARCHAR">
<cfprocparam value="#arguments.sSortDir_0#" cfsqltype="CF_SQL_VARCHAR">
<cfprocresult name="getUploadDtls">
</cfstoredproc>
<cfset userArray = arrayNew(1)>
<cfloop query="getUploadDtls">
<cfif UserSessionID eq "">
<cfset deleteLink = "<span class='delete-link link'>Delete</span>" />
<cfelse>
<cfset deleteLink = "">
</cfif>
<cfset userStruct = {}>
<cfset userStruct.ID = UploadFileID>
<cfset userStruct.ORG_NAME = OriginalFileName>
<cfset userStruct.GEN_NAME = SystemFileName>
<cfset userStruct.TYPE = DocumentName>
<cfset userStruct.PATH = FilePath>
<cfset userStruct.URL = "<a href='renderpdf.cfm?path=#FilePath#&name=#OriginalFileName#' target='_blank'>Preview</a>">
<cfset userStruct.DELETE = deleteLink>
<cfset arrayAppend(userArray, userStruct) >
</cfloop>
<cfif getUploadDtls.RecordCount GT 0>
<cfset firstRow = queryGetRow(getUploadDtls,1)>
<cfset record_count = firstRow.record_count>
<cfelse>
<cfset record_count = 0>
</cfif>
<cfset returnStruct = {}>
<cfset returnStruct['iTotalRecords'] = record_count>
<cfset returnStruct['iTotalDisplayRecords'] = record_count>
<cfset returnStruct['sEcho'] = arguments.sEcho>
<cfset returnStruct['aaData'] = userArray>
<cfset resultsJSON = SerializeJSON(returnStruct)>
<cfreturn resultsJSON>
</cffunction>
</cfcomponent>
The Json result returning from my cffunction is given below.
{""aaData"":[{""GEN_NAME"":""sample_489.pdf"",""PATH"":""C://Standout/web_uploads/100004/Medical Reports/sample_489.pdf"",""DELETE"":"""",""ORG_NAME"":""sample.pdf"",""ID"":77,""TYPE"":""Medical Report"",""URL"":""<a href='renderpdf.cfm?path=C://Standout/web_uploads/100004/Medical Reports/sample_489.pdf&name=sample.pdf' target='_blank'>Preview</a>""}],""iTotalDisplayRecords"":1,""iTotalRecords"":1,""sEcho"":1}"
I can't figure out what is the issue can someone help?

First of I would remove those curly braces you use wrapping your structs.
SerializeJson() already works pretty well if you just pass in your structs.
It seems like your JSON is not valid which is probably causing the error, or your datatable isn't configured properly.
Honestly I'd recommend just filling your table with a cfloop.
<cfloop query="myQuery">
<tr>
<td>
#myQuery.someData#
</td>
...
</tr>
</cfloop>
If you load your data on page load this solution might work just as well.
The datatable API can be hit or miss sometimes imo.

Related

Display Events in Fullcalendar underneath calendar?

I am having a hard time to do this. The calendar Displays the events in the calendar however, I would like to be able to list the events as well below the calendar so you can see the full name of the events that are in the current month. I have the following code(I am using coldfusion and Mura and I am new to both):
<cffunction name="MultipleFeaturedEvents">
<cfargument name="feedName" type="string" default="702771E7-155D-0201-11DF8865B175735F"/>
<cfargument name="maxMonths" type="numeric" default="3" />
<cfargument name="groupDailyEvents" default="true" />
<cfscript>
var rs = '';
var subRS1 = '';
var local = {};
local.listIDs = '';
local.util = $.getCalendarUtility();
local.rsItems = local.util.getCalendarItems(calendarid=arguments.feedName, start=Now(), end=DateAdd('m', val(4), Now()));
var qoq = new Query();
qoq.setDBType('query');
qoq.setAttributes(rs=local.rsItems, maxRows=val(1));
qoq.setSQL('
SELECT *
FROM rs
ORDER BY displaystart ASC
');
var qoqResult = qoq.execute().getResult();
local.it = $.getBean('contentIterator').setQuery(qoqResult);
</cfscript>
<cfsavecontent variable="local.str">
<cfoutput>
<cfset ctr=1 />
<!---<div>#local.it.hasNext()#</div>--->
<cfloop condition="(local.it.hasNext()) AND (ctr LT 4)">
<cfset local.item = local.it.next() >
<cfif not ListFind(local.listIDs, local.item.getValue('contentid'))>
<cfif ctr eq 1>
<!--- TODO: set a default image if no image is available --->
<div class="hidden-xs col-md-2">
<p class="upcoming-events-image"><img src="#local.item.getImageURL()#" alt="#HTMLEditFormat(local.item.getTitle())#"> </p>
</div>
<div class="col-md-offset-0 col-md-4" id="featured-event">
<h3>#HTMLEditFormat(local.item.getMenuTitle())#</h3>
<i class="fa fa-calendar fixIconCal"></i>
<!---#local.item.getDisplaystart()#--->
#LSDateFormat(local.item.getValue('displayStart'), "mmm d, yyyy")#
<cfquery dbtype="query" name="subRS1">
select *
from rsItems
where rsItems.contentid = <cfqueryparam value="#local.item.getValue('contentid')#" />
</cfquery>
<cfif subRS1.recordcount gt 1>
<!--- end date --->
<cfset enddate = ListLast(ValueList(subRS1.displaystop)) />
<cfif IsValid('date', enddate)>
- #LSDateFormat(enddate)#
</cfif>
</cfif>
<br />
<i class="fa fa-clock-o"></i>
#timeFormat(local.item.getValue('displayStart'), "h:mm tt")# - #timeFormat(local.item.getValue('displayStop'), "h:mm tt")#
<br />
<i class="fa fa-map-marker"></i>
Location Information
<!--- Summary --->
<div class="featured-event-summary">
<cfif Len(local.item.getValue('summary'))>
#local.item.getValue('summary')#
</cfif>
</div>
</div>
<cfelse>
</cfif>
</cfif>
</cfloop>
</cfoutput>
</cfsavecontent>
<cfreturn local.str />
</cffunction>
Below is what I am trying to do:
Any help would be appreciated. Thanks
Don't know if you can use plain JS (I don't know ColdFusion), but typically you can retrieve all FullCalendar events by invoking:
$('#calendar').fullCalendar('clientEvents')
Which returns array of Events, then you can iterate over it and render some list.
Hope this helps.
EDIT:
So maybe something like
$('#calendar').fullCalendar('clientEvents', function(ev) {
//will loop for each event you have in the calendar
console.log(ev); //event
});
And you can use something like:
$('#calendar').fullCalendar('clientEvents', function(ev) {
$('.your-list-container').append('<div>' + ev.title + '</div>');
});
this is js code , hope its help you ..
//get the start and the end of the current view
var startDate = $('#idOfCalendar').fullCalendar('getView').start;
var endDate = $('#idOfCalendar').fullCalendar('getView').end;
var eventsNames= new Array();
var todaysEvents = $('#idOfCalendar').fullCalendar('clientEvents', function (event) {
if (event.start >= startDate && event.start <= endDate
|| event.end >= startDate && event.end <= endDate) {
eventsNames.push(event.title)
//take what do you whant from the event object
return true;
}
});

Date issue in coldfusion

I have a report which has the date selection as show below. When the report is first loaded it will show the data for the current month ie in this case from {ts '2014-06-01 00:00:00'} to {ts '2014-07-01 00:00:00'};range in all the queries on the page. When I select a date from the dropdown and submit the page, the queries still take the start and end date as 6/1 to 7/1 instead of the selected month. I tried debugging it but still not able to get it to work. Any suggestions here?
I have updated My form is like below. I want the first radio button to be selected on the first page load, I am just making the other selection empty on click of the radio button. Is there a way to save what is in the selection and just display results for the criteria selected?please suggest
<script>
function makeChoice() {
var obj1 = document.getElementById('month_dt')
var obj2 = document.getElementById('start_date')
var obj3 = document.getElementById('end_date')
if (document.getElementById('but1').checked) {
obj2.value = '';
obj3.value = '';
}
else if (document.getElementById('but2').checked) {
obj1.value = '';
}
}
</script>
<form name="month_year" method="get">
<div>
<table>
<tr>
<th align="right">
<input type="radio" name="datesel" value="1" id="but1" onClick="return makeChoice();"/>
Month/Year:</th>
<td align="left">
<select name="month_dt" id="month_dt">
<option value="">---Select one---</option>
<cfloop from="0" to="#diff_month_cnt#" index="ii">
<cfset temp_dt = dateAdd("m", -1 * ii, today) />
<cfset temp_dt = createDate(year(temp_dt), month(temp_dt), 1) />
<cfset isselected = "" />
<cfif temp_dt EQ the_month_dt>
<cfset isselected = "selected" />
</cfif>
<option value="#dateFormat(temp_dt, 'mm/dd/yyyy')#" #isselected#>#dateFormat(temp_dt, "mmmm yyyy")#</option>
</cfloop>
</select>
</td>
</tr>
<tr><td colspan="2" align="center"><em>- or -</em></td></tr>
<tr>
<th align="right"> <input type="radio" name="datesel" value="2" id="but2" onClick="return makeChoice();"/>Start Date:</th>
<td>
<input id="start_date" type="text" name="start_date" <cfif isdate(url.start_Date)>value="#dateFormat(url.start_date, 'mm/dd/yyyy')#"</cfif> size="10" maxlength="10" autocomplete="off" />
</td>
</tr>
<tr>
<th align="right">End Date:</th>
<td>
<input id="end_date" type="text" name="end_date" <cfif isdate(url.end_Date)>value="#dateFormat(url.end_date, 'mm/dd/yyyy')#"</cfif> size="10" maxlength="10" autocomplete="off" />
</td>
</tr>
<input type="submit" value=" OK " />
<cfif isDate(url.month_dt) and url.datesel eq 1>
<cfset begin_dt = createDate(year(month_dt), month(month_dt), 1) />
<cfset end_dt = dateAdd("m", 1, begin_dt) />
<cfelseif isDate(url.start_date) AND isDate(url.end_date) and url.datesel eq 2 >
<cfset begin_dt = url.start_date />
<cfset end_dt = url.end_date />
</cfif>
<cfset the_month_dt = createDate(year(begin_dt), month(begin_dt), 1) />
In the queries like
1) WHERE q.quizdate >= <cfqueryparam cfsqltype="CF_SQL_DATE" value="#the_month_dt#" />
AND q.quizdate < <cfqueryparam cfsqltype="CF_SQL_DATE" value="#dateAdd('m', 1, the_month_dt)#" />
2) WHERE r.create_dt >= <cfqueryparam cfsqltype="CF_SQL_DATE" value="#begin_dt#" />
AND r.create_dt < <cfqueryparam cfsqltype="CF_SQL_DATE" value="#end_dt#" />
You need to change the following code:
<cfif isDate(url.month_dt)>
<cfset begin_dt = createDate(year(month_dt), month(month_dt), 1) />
</cfif>
<cfif isDate(url.start_date)>
<cfset begin_dt = url.start_date />
</cfif>
<cfset end_dt = dateAdd("m", 1, begin_dt) />
<cfif isDate(url.end_date)>
<cfset end_dt = url.end_date />
</cfif>
to be:
<cfif isDate(url.month_dt)>
<cfset begin_dt = createDate(year(month_dt), month(month_dt), 1) />
<cfset end_dt = dateAdd("m", 1, begin_dt) />
<cfelseif isDate(url.start_date) AND isDate(url.end_date)>
<cfset begin_dt = url.start_date />
<cfset end_dt = url.end_date />
</cfif>
Use DaysInMonth to look for the last date in month. As more info is given in the question, my answer is modified a bit. You need to disable and clear the values in Start/End form fields when a user chooses to select by month and vice versa. Otherwise, the users might get confused. Place the code before the form to get the start/end dates selected by a user. The final start/end dates are begin_dt and end_dt
<cfset thisMonth = createDate(year(now()), month(now()), 1) />
<cfparam name="url.month_dt" default="" />
<cfparam name="url.start_date" default="" />
<cfparam name="url.end_date" default="" />
<cfparam name="bRadioMonth" default="" />
<cfparam name="bRadioStartEnd" default="" />
<cfif len(url.month_dt) AND isDate(url.month_dt)>
<cfset begin_dt = createDate(year(url.month_dt), month(url.month_dt), 1) />
<cfset end_dt = createDate(year(begin_dt), month(begin_dt), DaysInMonth(begin_dt)) />
<!--- Disable form fields start_date and end_date --->
<cfset bFieldMonth = "">
<cfset bFieldStartEnd = "disabled">
<cfset bRadioMonth = "checked">
<cfelseif len(url.start_date) AND len(url.end_date)
AND isDate(url.start_date) AND isDate(url.end_date)>
<cfset begin_dt = createDate(year(url.start_date), month(url.start_date), day(url.start_date)) />
<cfset end_dt = createDate(year(url.end_date), month(url.end_date), day(url.end_date)) />
<!--- Disable form field month_dt --->
<cfset bFieldMonth = "disabled">
<cfset bFieldStartEnd = "">
<cfset bRadioStartEnd = "checked">
<cfelse>
<cfset begin_dt = thisMonth />
<cfset end_dt = createDate(year(begin_dt), month(begin_dt), DaysInMonth(begin_dt)) />
<!--- Default to disable form fields start_date and end_date --->
<cfset bFieldMonth = "">
<cfset bFieldStartEnd = "disabled">
<cfset bRadioMonth = "checked">
</cfif>
javascript:
<script>
function makeChoice() {
var fieldMonth = document.getElementById('month_dt');
var fieldStart = document.getElementById('start_date');
var fieldEnd = document.getElementById('end_date');
if (document.getElementById('but1').checked) {
fieldMonth.disabled = false;
fieldStart.disabled = true;
fieldEnd.disabled = true;
fieldStart.value = '';
fieldEnd.value = '';
}
else if (document.getElementById('but2').checked) {
fieldMonth.options[0].selected = true;
fieldMonth.disabled = true;
fieldStart.disabled = false;
fieldEnd.disabled = false;
}
}
</script>
If form is submitted, return selected start/end dates and run query:
<cfoutput>
Selected Start Date: #dateFormat(begin_dt, 'mm/dd/yyyy')# End Date: #dateFormat(end_dt, 'mm/dd/yyyy')#
</cfoutput>
<cfif isdefined("form.submit")>
<!---
Run Query.
1) WHERE q.quizdate >= <cfqueryparam cfsqltype="CF_SQL_DATE" value="#begin_dt#" />
AND q.quizdate < <cfqueryparam cfsqltype="CF_SQL_DATE" value="#DATEADD('d',1,end_dt)#" />
2) WHERE r.create_dt >= <cfqueryparam cfsqltype="CF_SQL_DATE" value="#begin_dt#" />
AND r.create_dt < <cfqueryparam cfsqltype="CF_SQL_DATE" value="#DATEADD('d',1,end_dt)#" />
--->
</cfif>

Invalid tag nesting configuration in ColdFusion 10?

How do I get around this ColdFusion error?
I'm following this ColdFusion tutorial. When I tried to implement the code in ColdFusion 10 I got the following error:
Invalid tag nesting configuration. A query driven queryloop tag is
nested inside a queryloop tag that also has a query attribute. This is
not allowed. Nesting these tags implies that you want to use grouped
processing. However, only the top-level tag can specify the query that
drives the processing.
The error occurred in line 76
74 : </cfloop>
75 : </tr>
76 : <cfoutput query="data" startRow="2">
77 : <tr>
78 : <cfloop index="c" list="#colList
Here is the code:
<cfset showForm = true>
<cfif structKeyExists(form, "xlsfile") and len(form.xlsfile)>
<!--- Destination outside of web root --->
<cfset dest = getTempDirectory()>
<cffile action="upload" destination="#dest#" filefield="xlsfile" result="upload" nameconflict="makeunique">
<cfif upload.fileWasSaved>
<cfset theFile = upload.serverDirectory & "/" & upload.serverFile>
<cfif isSpreadsheetFile(theFile)>
<cfspreadsheet action="read" src="#theFile#" query="data" headerrow="1">
<cffile action="delete" file="#theFile#">
<cfset showForm = false>
<cfelse>
<cfset errors = "The file was not an Excel file.">
<cffile action="delete" file="#theFile#">
</cfif>
<cfelse>
<cfset errors = "The file was not properly uploaded.">
</cfif>
</cfif>
<cfif showForm>
<cfif structKeyExists(variables, "errors")>
<cfoutput>
<p>
<b>Error: #variables.errors#</b>
</p>
</cfoutput>
</cfif>
<form action="test.cfm" enctype="multipart/form-data" method="post">
<input type="file" name="xlsfile" required>
<input type="submit" value="Upload XLS File">
</form>
<cfelse>
<style>
.ssTable {
width: 100%;
border-style:solid;
border-width:thin;
}
.ssHeader { background-color: #ffff00; }
.ssTable td, .ssTable th {
padding: 10px;
border-style:solid;
border-width:thin;
}
</style>
<p>
Here is the data in your Excel sheet (assuming first row as headers):
</p>
<cfset metadata = getMetadata(data)>
<cfset colList = "">
<cfloop index="col" array="#metadata#">
<cfset colList = listAppend(colList, col.name)>
</cfloop>
<cfif data.recordCount is 1>
<p>
This spreadsheet appeared to have no data.
</p>
<cfelse>
<table class="ssTable">
<tr class="ssHeader">
<cfloop index="c" list="#colList#">
<cfoutput><th>#c#</th></cfoutput>
</cfloop>
</tr>
<cfoutput query="data" startRow="2">
<tr>
<cfloop index="c" list="#colList#">
<td>#data[c][currentRow]#</td>
</cfloop>
</tr>
</cfoutput>
</table>
</cfif>
</cfif>
Try this:
<cfoutput>
<cfloop query="data" startRow="2">
<tr>
<cfloop index="c" list="#colList#">
<td>#data[c][currentRow]#</td>
</cfloop>
</tr>
</cfloop>
</cfoutput>

Issues with coldfusion query function call inside a query loop

I have a query loop and inside that loop, I make a cfc function call to return a second query. It's doing weird things with the display:
In the example below, instead of making a function call to obtain the second query, I create a simple loop. This displays fine. View the actual page here
<cfoutput>
<cfif qCal.recordcount>
<a class="control" onClick="return hs.getExpander(this).printHtml()" href="##">Print</a>
</cfif>
<table width="100%" cellspacing="0" cellpadding="4">
<cfloop query="qCal">
<tr>
<td align="middle" valign="top" style="width:150px;">
<a title="View full-sized image" onclick="return hs.expand(this)" href="/images/classes/#qCal.image#" class="highslide"><img src="/images/classes/#qCal.thumb#" class="resize2"></a></td>
<td>
<table cellspacing="0" cellpadding="3">
<tr>
<td colspan="2" class="textNormal"><h2>#qCal.title#</h2></td>
</tr>
<tr>
<td class="textNormal"><strong>Date:</strong></td>
<td class="textNormal"><strong>Time:</strong></td>
</tr>
<cfloop from="1" to="5" index="i"> <!--- basic loop --->
<tr>
<td>#i#</td>
<td></td>
</tr>
</cfloop>
</table>
</td>
</tr>
</cfloop>
</table>
</cfoutput>
But, as soon as I make a function call to obtain a secondary query, inexplicable things happen with the display. View the actual page here (which renders half-cooked html code).
<cfoutput>
<cfif qCal.recordcount>
<a class="control" onClick="return hs.getExpander(this).printHtml()" href="##">Print</a>
</cfif>
<table width="100%" cellspacing="0" cellpadding="4">
<cfloop query="qCal">
<cfsilent>
<cfset qCalItems = o_system.getCalendarItems(
start=dateformat(vStartDate,"yyyy-mm-yy"),
end=dateformat(vEndDate,"yyyy-mm-yy"),
classID=qCal.classID,
forQuarterlyCalendar=true,
order_by="i.startDate")>
</cfsilent>
<tr>
<td align="middle" valign="top" style="width:150px;">
<a title="View full-sized image" onclick="return hs.expand(this)" href="/images/classes/#qCal.image#" class="highslide"><img src="/images/classes/#qCal.thumb#" class="resize2"></a></td>
<td>
<table cellspacing="0" cellpadding="3">
<tr>
<td colspan="2" class="textNormal"><h2>#qCal.title#</h2></td>
</tr>
<tr>
<td class="textNormal"><strong>Date:</strong></td>
<td class="textNormal"><strong>Time:</strong></td>
</tr>
<cfloop query="qCalItems">
<tr bgcolor="#iif(qCalItems.CurrentRow MOD(2) eq 1,de('ffffff'),de('EFEFEF'))#">
<td>#DayOfWeekAsString(dayofweek(qCalItems.startDate))# #dateformat(qCalItems.startDate,"dd mmm yyyy")#</td>
<td>#qCalItems.startTime#-#qCalItems.endTime#</td>
</tr>
</cfloop>
</table>
</td>
</tr>
</cfloop>
</table>
</cfoutput>
UPDATE - CFC CODE ADDED
NOTE: Function returns either a struct or a query depending on the argument "forQuarterlyCalendar". It definitely returns a query object in this case. I have dumped the query out and confirm that it is a valid query object.
<cffunction name="getCalendarItems" access="remote" returntype="any" output="false" returnformat="json">
<cfargument name="classID" type="any" required="false" default="">
<cfargument name="forSelect" type="boolean" required="false" default="false">
<cfargument name="forQuarterlyCalendar" type="boolean" required="false" default="false">
<cfargument name="start" type="any" required="false" default="">
<cfargument name="end" type="any" required="false" default="">
<cfargument name="order_by" type="any" required="false" default="c.title">
<cfargument name="sort_direction" type="any" required="false" default="asc">
<cfargument name="json" type="boolean" required="false" default="true">
<cfargument name="must_have_store_item" type="boolean" required="false" default="true">
<cfset var qClass = 0>
<cfset var realStart = "">
<cfset var realEnd = "">
<cfset var results = []>
<cfset var vUrl = "">
<cfset var vId = "">
<cfset var vTitle = "">
<cfset var vStart = "">
<cfif len(trim(arguments.start))>
<cfset realStart = EpochTimeToLocalDate(arguments.start)>
</cfif>
<cfif len(trim(arguments.end))>
<cfset realEnd = EpochTimeToLocalDate(arguments.end)>
</cfif>
<cfquery name="qClass" datasource="#application.datasource#">
select <cfif arguments.forSelect>
c.title, i.calendarItemID as id, convert(varchar, i.startDate, 103)+' '+i.startTime+'-'+i.endTime as text
<cfelseif arguments.forQuarterlyCalendar>
c.description, i.calendarItemID as id, i.startDate, i.startTime, i.endTime
<cfelse>
i.calendarItemID, i.startDate, i.startTime, i.endTime
,c.classID, c.title, c.description, c.price, c.places, c.exclusive, c.discounted, c.url
,s.storeItemID
</cfif>
from calendarItem i
<cfif arguments.must_have_store_item>
join storeItem s on s.entityID = i.calendarItemID and s.storeItemTypeID = 3
</cfif>
join class c on c.classID = i.classID and c.active=1
where i.active=1
<cfif isnumeric(arguments.classID)>
and i.classID = <cfqueryparam value="#arguments.classID#" cfsqltype="cf_sql_integer">
</cfif>
<cfif len(trim(arguments.start))>
<cfif arguments.forQuarterlyCalendar>
and i.startDate >= <cfqueryparam value="#arguments.start#" cfsqltype="cf_sql_date">
<cfelse>
and i.startDate >= <cfqueryparam value="#dateformat(realStart,'yyyy-mm-dd')#" cfsqltype="cf_sql_date">
</cfif>
</cfif>
order by #arguments.order_by# #arguments.sort_direction#
</cfquery>
<cfif qClass.recordcount>
<cfif not arguments.forSelect and not arguments.forQuarterlyCalendar>
<cfloop query="qClass">
<cfset vUrl = qClass["url"]>
<cfset vId = qClass["storeItemID"]>
<cfset vTitle = qClass["title"]>
<cfset vStart = GetEpochTimeFromLocal(qClass.startDate)>
<cfif not len(trim(url)) or len(trim(url)) is 0>
<cfset vUrl = "#application.webroot#/class_detail.cfm?id=#vId#">
</cfif>
<cfset s = structnew()>
<cfset s["id"] = vId>
<cfset s["url"] = vUrl>
<cfset s["title"] = vTitle>
<cfset s["start"] = vStart>
<cfset arrayappend(results, s)>
</cfloop>
<cfelse>
<cfset results = qClass>
</cfif>
</cfif>
<cfif arguments.json>
<cfcontent type="application/json">
</cfif>
<cfreturn results>
</cffunction>
You need to var scope 's':
<cfset s = structnew()>

cfchart data to display drive details indivisually

<html>
<head>
</head>
<body>
<cfhttp method="Get"
url="http://localhost:90/myweb/xmlwork/xmlfile.cfm">
<cfoutput>
#cfhttp.filecontent#
</cfoutput>
<br>
<br><br><br>
<!---<cffile action="read" file="http://localhost:90/myweb/xmlfile.cfm" variable="myxml">--->
<cfset mydoc = XmlParse(cfhttp.filecontent)>
<cfset dd = mydoc.StorageList.XmlChildren>
<cfset size = ArrayLen(dd)>
<cfoutput>
Number of Drive = #size#
<br>
</cfoutput>
<br>
<cfset myquery = QueryNew("DriveName,TotalSpace,FreeSpace") >
<cfset temp = QueryAddRow(myquery, #size#)>
<cfloop index="i" from = "1" to = #size#>
<cfset temp = QuerySetCell(myquery, "DriveName",
#mydoc.StorageList.DriveDetails[i].DriveName.XmlText#, #i#)>
<cfset temp = QuerySetCell(myquery, "TotalSpace",
#mydoc.StorageList.DriveDetails[i].TotalSpace.XmlText#, #i#)>
<cfset temp = QuerySetCell(myquery, "FreeSpace",
#mydoc.StorageList.DriveDetails[i].FreeSpace.XmlText#, #i#)>
</cfloop>
Contents of the: <br>
<cfdump var=#myquery#>
<br><cfloop index="i" from = "1" to = #size#>
<cfchart format="flash" show3d="true" chartwidth="300" chartheight="300" >
<cfchartseries type="pie">
<cfloop query="myquery">
<cfchartdata item="#TotalSpace#" value="#FreeSpace#">
</cfloop>
</cfchartseries>
</cfchart>
</cfloop>
<!---<cfloop index="i" from = "1" to = #size#>
<cfchart>
<cfchartseries
type="pie"
query="myquery"
valueColumn="TotalSpace"
itemColumn="FreePace"/>
</cfchart>
</cfloop>--->
</body>
</html>
i have this code for chart display,but it showing in one chart i want to display this in indivisual chart
Instead of constructing a query and using it to display in your chartseries, use a chartseries with cfchartdata to add the appropriate data to the chart.