celldata = "";
RecordList = "";
RecordIDList = "";
RecordNameList = "";
RecordNameSortList = "";
RecordListCount = 0;
eventQry = QueryNew('tmp');
if ( NOT StructKeyExists(request,"dsCacheData") )
request.dsCacheData = StructNew();
if ( NOT StructKeyExists(request.dsCacheData,"eventsQry") )
request.dsCacheData.eventsQry = application.ptCalendar.calEventsDAO.getEvents(useCache=true);
// Set cell value to record list
RecordList = request.datasheet.currentColumnValue;
if ( LEN(TRIM(RecordList)) )
RecordListCount = ListLen(RecordList,",");
if ( RecordListCount EQ 0 )
RecordNameList = "[NONE SELECTED]";
else
{
RecordNameList = '';
QofQ = new Query();
QofQ.setDBType('query');
QofQ.setAttributes(rs=request.dsCacheData.eventsQry); // needed for QoQ
QofQ.addParam(name='eventids', value='#RecordList#', cfsqltype='cf_sql_varchar', list=true);
sqlStr = "SELECT title FROM rs WHERE calEventID IN (:eventids)";
QofQ.setSQL(sqlStr);
// Final Query of Query Result
eventQry = QofQ.execute().getResult();
if ( eventQry.RecordCount )
RecordNameList = ValueList(eventQry.title,',');
// Copy to the sort list
RecordNameSortList = RecordNameList;
if ( ListLen(RecordNameList,",") EQ 0 )
{
if ( RecordListCount GT 1 )
RecordNameList = "[SELECTED EVENTS DO NOT EXIST]";
else
RecordNameList = "[SELECTED EVENT DOES NOT EXIST]";
}
RecordNameList= REREPLACE(RecordNameList,",","
","all");
}
RecordNameList = REREPLACE(RecordNameList,"[\s]"," ","all");
#RecordNameList#