Issue with pagination using SQL Server and JQgrid, - sql

I have the following code where from the query I'm trying to get the first 500 records and then next 500 and so on .
Here is my code, I'm stuck as to what and where I should make the change to make it work
<cffunction name="queryConvertForJQGRID" access="package" returntype="struct" output="no">
<cfargument name="q" type="query" required="yes">
<cfargument name="page" type="numeric" required="no" default="1">
<cfargument name="rows" type="numeric" required="no" default="10">
<cfset var result = structnew()>
<cfset var rowStruct = structnew()>
<cfset var col = "">
<cfset result["page"] = arguments.page>
<cfset result["total"] = ceiling(arguments.q.recordcount/arguments.rows)>
<cfset result["records"] = arguments.q.recordcount>
<cfset result["rows"] = arraynew(1)>
<cfoutput query="arguments.q" startrow="#(arguments.page-1)*arguments.rows+1#" maxrows="#arguments.rows#">
<cfset rowStruct = structnew()>
<cfset rowStruct['viewed'] = viewed>
<cfset rowStruct['id'] = q['id'][currentrow]>
<cfset rowStruct['status'] = q['status'][currentrow]>
<cfset rowStruct['template'] = q['template'][currentrow]>
<cfset rowStruct['line'] = q['line'][currentrow]>
<cfset rowStruct['error_message'] = q['error_message'][currentrow]>
<cfset rowStruct['error_type'] = q['error_type'][currentrow]>
<cfset rowStruct['datein'] = q['datein'][currentrow]>
<cfset arrayappend(result.rows, rowStruct)>
</cfoutput>
<cfreturn result />
</cffunction>
<cffunction name="getgrouped" returntype="any" access="remote" output="false">
<cfargument name="table" required="true" default="errors">
<cfargument name="usedsn" default="" required="true">
<cfargument name="callback" default="" required="false">
<cfargument name="page" required="no" default="1">
<cfargument name="rows" required="no" default="500">
<cfargument name="sidx" required="no" default="">
<cfargument name="sord" required="no" default="ASC">
<cfargument name="acelem" required="no" type="any">
<cfset var dsn = dsnSettings(arguments.usedsn)>
<cfset var groupedget = "">
<cfset var result = structnew()>
<cfset var rowStruct = structnew()>
<cfset var col = "">
<cfset result["rows"] = arraynew(1)>
<cfquery name="groupedget" datasource="#dsn#">
WITH List AS (
SELECT row_number() over(ORDER BY mi.id) AS rowNum
, viewed
, status
, mi.errorid
, FORMAT(datein, 'MMMM d, yyyy h:mm:ss tt PST', 'en-US') AS datein
, mi.error_message
, upper(mi.error_type) AS error_type
, mi.line
, mi.template
, mi.id
FROM #arguments.table# mi
)
, ListRecordCount AS (
SELECT *
FROM List , ( SELECT MAX(rowNum) AS recordCount FROM List ) recordCount
)
SELECT *
FROM ListRecordCount
WHERE rowNum BETWEEN #page# AND #rows#
</cfquery>
<cfset q = groupedget>
<cfreturn queryConvertForJQGRID(q, arguments.page, arguments.rows)>
</cffunction>
But it queries only 500 rows and that's it, no more pagination happening in the JQgrid.

Related

datatables for mysql seems wrong

I have the datatables for coldfusion version 10 for mysql, but there seems to be some syntactical errors i am unable to solve and also the pagination and sorting does not work properly, it tends to keep the processing icon keeps showing even in the console it show 200, it happens on search also
my CFM Code
<cffunction name="getDataForTable" access="remote" returnformat="json" returntype="any" output="false">
<cfargument name="inParam" type="any" default="#{}#">
<cfset var isQueryUsed = structkeyexists(inParam,'queryName') and inParam.queryName neq ''>
<cfif isQueryUsed>
<cfset var qryResults = queryexecute("#PreserveSingleQuotes(inParam.queryName)#",{},{datasource='xxx'})>
</cfif>
<cfset var tableFields = (inParam.queryName neq '') ? qryResults.getMetaData().getColumnLabels() : inParam.Columns/>
<cfset noOfTableFields = ArrayLen(tableFields)>
<cfset searchFields= tableFields>
<cfset noOfSearchFields = ArrayLen(searchFields)>
<cfset start= Int(Val(inParam.start))>
<cfset length= Int(Val(inParam.length))>
<cfset search= Trim(inParam['search[value]'])>
<cfset iSortCol_0= Int(Val(inParam['order[0][column]']))>
<cfif LCase(inParam['order[0][dir]']) EQ 'asc'>
<cfset sSortDir_0='asc'>
<cfelse>
<cfset sSortDir_0='desc'>
</cfif>
<cfset queryWhere="">
<cfif (search NEQ '')>
<cfset queryWhere ="AND (">
<cfloop from="1" to="#noOfSearchFields#" index="counter">
<cfset queryWhere=queryWhere &" lower(#searchFields[counter]#) LIKE '%#Lcase(search)#%' ">
<cfif counter LT noOfSearchFields>
<cfset queryWhere=queryWhere&" OR">
</cfif>
</cfloop>
<cfset queryWhere=queryWhere&")">
</cfif>
<cfif iSortCol_0 NEQ 0>
<cfset queryOrder='ORDER BY #tableFields[iSortCol_0 + 1]# #sSortDir_0#'>
<cfelse>
<cfset queryOrder=''>
</cfif>
<cfif length NEQ 0>
<cfset queryLimit='LIMIT #length# OFFSET #start#'>
<cfelse>
<cfset queryLimit=''>
</cfif>
<cfif isQueryUsed>
<cfquery name="queryResult" datasource="xxx">
#PreserveSingleQuotes(queryName)#
#PreserveSingleQuotes(queryWhere)#
#queryOrder#
#queryLimit#
</cfquery>
<cfquery name="querycount" datasource="xxx">
#PreserveSingleQuotes(queryName)#
#PreserveSingleQuotes(queryWhere)#
#queryOrder#
#queryLimit#
</cfquery>
<cfelse>
<cfquery name="queryResult" datasource="xxx">
select #ArrayToList(tableFields)# FROM #dataTable# #PreserveSingleQuotes(queryWhere)# #queryOrder# #queryLimit#
</cfquery>
<cfquery name="querycount" datasource="xxx">
select count(*) OVER() AS total FROM #dataTable# #PreserveSingleQuotes(queryWhere)# #queryOrder# #queryLimit#
</cfquery>
</cfif>
<cfsavecontent variable="datatablesjson">
<cfloop from="1" to="#queryResult.RecordCount#" index="counter">
<cfoutput>
[
<cfloop from="1" to="#noOfTableFields#" index="innerCounter">
<cfif tableFields[innerCounter] EQ "start_date">
"#JSStringFormat(dateformat(queryResult[tableFields[innerCounter]][counter],'yyyy/mm/dd'))#"
<cfelse>
"#JSStringFormat(queryResult[tableFields[innerCounter]][counter])#"
</cfif>
<cfif innerCounter LT noOfTableFields>
,
</cfif>
</cfloop>
]
<cfif counter LT queryResult.RecordCount>
,
</cfif>
</cfoutput>
</cfloop>
</cfsavecontent>
<cfif queryResult.RecordCount is 0>
<cfset datatablesjson=' [ '>
<cfloop from="1" to="#noOfTableFields#" index="counter">
<cfset datatablesjson=datatablesjson>
<cfif counter LT noOfTableFields>
<cfset datatablesjson=datatablesjson&' , '>
</cfif>
</cfloop>
<cfset datatablesjson=datatablesjson&' ] '>
</cfif>
<cfsavecontent variable="sGrid">
<cfoutput>
{
"draw": #Int(Val(inParam.draw))#,
"recordsTotal": <cfif querycount.recordcount GT 0>#querycount.recordcount#<cfelse>0</cfif>,
"recordsFiltered": <cfif querycount.recordcount GT 0>#querycount.recordcount#<cfelse>0</cfif>,
"data": [#datatablesjson#]
}
</cfoutput>
</cfsavecontent>
<cfreturn sGrid>
</cffunction>
my datatables code
$(document).ready( function () {
var table = $('.display').DataTable({
"order" : [[ 0, "desc" ]],
"stateSave" : true,
"processing" : true,
"serverSide" : true,
"ajax" : "ajaxprocess.cfm"
});
});
ajaxprocess.cfm as :
<cfset sJSON = getDataForTable(url)>
<cfcontent reset="Yes" />
<cfoutput>#trim(sJSON)#</cfoutput>

ColdFusion 2018 Bean-DAO-Manager OOP Logic Errors

I am trying to learn about OOP in ColdFusion by recreating a proven Bean-DAO-Manager setup. In the example, I only use Create but the issue also exists for Read, Update and Delete.
I think I make some mistakes when passing the arguments.
From index.cfc, I create an object from testBeanDaoManager.cfc, which holds the API. Here, the bean is created that should hold the properties. From there the manager is called which calls the db-query in the file testDAO.cfc.
The error states that the bean's method getName() was not found (more details at the end of the post).
Any help is greatly appreciated.
Database and table: testBeanDao.APP.TESTBEAN
Files:
/index.cfm, /api/testBeanDaoManager.cfc, /logic/bean/testBean.cfc, /logic/dao/testDAO.cfc, /logic/manager/testManager.cfc
/index.cfm:
<cfscript>
obj = createObject("component","api.testBeanDaoManager");
add = invoke(obj,"addName", {ID=0, Name="Meo"});
</cfscript>
/api/testBeanDaoManager.cfc
component rest=true restpath="names" {
remote any function gettestBean(ID){
var nameManager = createObject('component', 'logic.manager.testManager');
var nameBean = nameManager.getName(arguments.ID);
return nameBean;
}
remote any function addName(numeric ID, string Name, restArgSource="path", any Data = {}) httpmethod="post" restpath="add/{id}" {
var bean = gettestBean(arguments.ID);
var nameManager = createObject('component', 'logic.manager.testManager');
bean.setName(arguments.Name);
bean = nameManager.addName(bean);
return bean;
}
}
/logic/manager/testManager.cfc
<cfcomponent output="false" >
<cffunction name="init" output="false" access="public" returntype="testManager">
<cfset super.init( gateway=createObject("component","logic.gateway.testGateway").init(), DAO=createObject("component","logic.dao.testDAO").init())
/>
<cfreturn this />
</cffunction>
/**
* Initializing Bean
*/
<cffunction name="gettestBean" output="false" returntype="any">
<cfset var bean = createObject("component","logic.bean.testBean") />
<cfreturn bean />
</cffunction>
<cffunction name="addName" output="false" returntype="any">
<cfargument name="bean" required="true" />
<cfset var dao = createObject("component","logic.dao.testDAO") />
<cfset dao.insertName(bean) />
<cfreturn bean />
</cffunction>
...
/logic/dao/testDAO.cfc
<cffunction name="insertName" returntype="any" output="false">
<cfargument name="bean" type="any" required="true" />
<cfquery name="local.result" datasource="testBeanDao" >
INSERT INTO app.testBean (
Name
)
VALUES (
<cfqueryparam value="#arguments.bean.getName()#" cfsqltype="cf_sql_varchar">
)
</cfquery>
<cfreturn local.result />
</cffunction>
/logic/bean/testBean.cfc
<cfcomponent displayname="testBean" output="false">
<cffunction name="init" access="public" output="false" returntype="testBean">
<cfset super.init() />
<cfset variables.instance.ID = 0 />
<cfset variables.instance.Name = arguments.Name />
<cfreturn this />
</cffunction>
<cffunction name="load" access="public" returntype="any" output="false">
<cfargument name="ID" type="numeric" required="true"/>
<cfargument name="Name" type="string" required="true"/>
<cfset setID(arguments.ID) />
<cfset setName(arguments.Name) />
<cfreturn this />
</cffunction>
<cffunction name="setName" returntype="void" access="public" output="false">
<cfargument name="Name" type="string">
<cfset variables.instance.Name = arguments.Name />
</cffunction>
<cffunction name="getName" returntype="string" access="public" output="true">
<cfreturn variables.instance.Name />
</cffunction>
<cffunction name="setID" returntype="void" access="public" output="false">
<cfargument name="ID" type="numeric" required="true" />
<cfset variables.instance.ID = arguments.ID />
</cffunction>
<cffunction name="getID" returntype="numeric" access="public" output="true">
<cfreturn variables.instance.ID />
</cffunction>
</cfcomponent>
Error Message:
The web site you are accessing has experienced an unexpected error.
Please contact the website administrator.
The following information is meant for the website developer for debugging purposes.
Error Occurred While Processing Request
The getName method was not found.
Either there are no methods with the specified method name and argument types or the getName method is overloaded with argument types that ColdFusion cannot decipher reliably. ColdFusion found 0 methods that match the provided arguments. If this is a Java object and you verified that the method exists, use the javacast function to reduce ambiguity.
The error occurred in C:/programs/cfusion/wwwroot/cfproject/logic/dao/testDAO.cfc: line 35
Called from C:/programs/cfusion/wwwroot/cfproject/logic/manager/testManager.cfc: line 45
Called from C:/programs/cfusion/wwwroot/cfproject/api/testBeanDaoManager.cfc: line 53
Called from C:/programs/cfusion/wwwroot/cfproject/index.cfm: line 85
33 : )
34 : VALUES (
35 : <cfqueryparam value="#arguments.bean.getName()#" cfsqltype="cf_sql_varchar">
36 : )
37 : </cfquery>
(too long for a comment)
You are calling
var bean = gettestBean(arguments.ID);
which points to gettestBean of /api/testBeanDaoManager.cfc. This one does
var nameManager = createObject('component', 'logic.manager.testManager');
var nameBean = nameManager.getName(arguments.ID);
return nameBean;
but logic.manager.testManager doesn't have any getName function. Even if it had one, you would have to return an instance (the bean), which is kinda misleading for a method called getName.

Edited - some PDFs generated are corrupt - using ColdFusion

Edit - There are some customer accounts that are reporting a $0 balance due on their online accounts but there is an actual balance due. It is with these accounts only that the PDFs will not open. Data import issue at this point?
I have a set of CF functions in which new PDFs are generated from database records and available on user accounts for download or viewing. The code has worked great up until a couple weeks ago, but now the new or old (previous monthly bills) PDFs will not open (corrupt) on the user account pages. The record data has not been changed or modified. Could this be CF update issue or what could have caused files to now generate corrupt? Any help is appreciated.
PDF Analysis of the corrupt PDF files gives:
PDF Errors:
Open file.
0x80410108 - E - The end-of-file marker was not found.
- File: 11118749.pdf
0x8041010A - E - The 'startxref' keyword or the xref position was not found.
- File: 11118749.pdf
0x80410108 - E - The end-of-file marker was not found.
- File: 11118749.pdf
Close file.
CF PDF Generation Code:
<cfcomponent>
<!---***************************************************************************--->
<cffunction name="getBill" access="public" returntype="query">
<cfargument name="billID" required="yes" default="">
<cfquery name="getPayment" datasource="#application.dsnName#" username="****" password="****">
SELECT * FROM ccos_cust_bill
WHERE billID = <cfqueryparam cfsqltype="cf_sql_integer" maxlength="20" value="#arguments.billID#">
</cfquery>
<cfreturn getPayment>
</cffunction>
<!---***************************************************************************--->
<!---***************************************************************************--->
<cffunction name="getCustBills" access="public" returntype="query">
<cfargument name="accountNum" required="yes" default="">
<cfquery name="getCustBills" datasource="#application.dsnName#" username="****" password="****">
SELECT * FROM ccos_cust_bill
WHERE accountNum = <cfqueryparam cfsqltype="cf_sql_integer" maxlength="20" value="#arguments.accountNum#">
ORDER BY billDate DESC, billID DESC
</cfquery>
<cfreturn getCustBills>
</cffunction>
<!---***************************************************************************--->
<!---***************************************************************************--->
<cffunction name="addBill" access="public" returntype="string">
<cfargument name="formvalues" required="yes" default="">
<cfquery name="addBill" datasource="#application.dsnName#" username="****" password="****">
INSERT INTO ccos_cust_bill (billID, accountNum, billDate, dueDate, billTotal)
VALUES (
<cfqueryparam cfsqltype="cf_sql_integer" maxlength="20" value="#arguments.formvalues.billID#">,
<cfqueryparam cfsqltype="cf_sql_integer" maxlength="20" value="#arguments.formvalues.accountNum#">,
<cfqueryparam cfsqltype="cf_sql_date" maxlength="20" value="#DateFormat(arguments.formvalues.billDate, "yyyy-mm-dd")#">,
<cfqueryparam cfsqltype="cf_sql_date" maxlength="20" value="#DateFormat(arguments.formvalues.dueDate, "yyyy-mm-dd")#">,
<cfqueryparam cfsqltype="cf_sql_decimal" scale="2" maxlength="20" value="#arguments.formvalues.billTotal#">
)
</cfquery>
<cfset addOK = "Y">
<cfreturn addOK>
</cffunction>
<!---***************************************************************************--->
<!---***************************************************************************--->
<cffunction name="getBillPDF" access="public" returntype="query">
<cfargument name="billID" required="yes" default="">
<cfargument name="accountNum" required="yes" default="">
<cfquery name="getPayment" datasource="#application.billsDsnName#" username="****" password="****">
SELECT * FROM ccos_bills
WHERE billID = <cfqueryparam cfsqltype="cf_sql_integer" maxlength="20" value="#arguments.billID#">
AND accountNum = <cfqueryparam cfsqltype="cf_sql_integer" maxlength="20" value="#arguments.accountNum#">
</cfquery>
<cfreturn getPayment>
</cffunction>
<!---***************************************************************************--->
<!---***************************************************************************--->
<cffunction name="getNextDueDate" access="public" returntype="string">
<cfargument name="accountNum" required="yes" default="">
<cfquery name="getNextDueDate" datasource="#application.dsnName#" username="****" password="****" maxrows="1">
SELECT dueDate FROM ccos_cust_bill
WHERE accountNum = <cfqueryparam cfsqltype="cf_sql_integer" maxlength="20" value="#arguments.accountNum#">
AND dueDate >= <cfqueryparam cfsqltype="cf_sql_date" maxlength="20" value="#DateFormat(now(), "yyyy-mm-dd")#">
ORDER BY dueDate
</cfquery>
<cfreturn getNextDueDate.dueDate>
</cffunction>
<!---***************************************************************************--->
</cfcomponent>
CF View PDF Code:
<cfparam name="URL.billID" default="">
<cfset getBillPDF = application.billCFC.getBillPDF('#URL.billID#','#session.accountNum#')>
<cfif getBillPDF.RecordCount GT 0>
<cfoutput query="getBillPDF">
<cfset fileData = "#BinaryDecode(billData, "Base64")#">
<cfheader name="content-disposition" value="inline; filename=#billID#.pdf" />
<cfcontent type="application/pdf" variable="#fileData#" />
</cfoutput>
<cfelse>
You are not authorized to view this bill.
</cfif>
PDF Import into Database
<!--- CCOS Bill PDF Data --->
<cfquery name="deleteData" datasource="#application.billsDsnName#" username="#application.billsDsnUser#" password="#application.billsDsnPass#">
DELETE FROM ccos_bills WHERE billDate < '#DateFormat(DateAdd("d", -180, now()), "yyyy-mm-dd")#'
</cfquery>
<!--- Check to see how many files Exist --->
<cfdirectory action="list" directory="#ExpandPath('.')#\files" name="filelist">
<cfset fileCount = 0>
<cfoutput query="filelist">
<cfif name CONTAINS "ccos_cust_bill_pdf"><cfset fileCount = fileCount + 1></cfif>
</cfoutput>
<!--- Loop over the files and Load the new data --->
<cfloop from="1" to="#fileCount#" index="i">
<cfquery name="insertData" datasource="#application.billsDsnName#" username="#application.billsDsnUser#" password="#application.billsDsnPass#">
LOAD DATA LOCAL INFILE '#Replace(ExpandPath('.'), "\", "\\", "ALL")#\\files\\ccos_cust_bill_pdf#i#.txt' IGNORE
INTO TABLE `ccos_bills`
FIELDS OPTIONALLY ENCLOSED BY '"'
TERMINATED BY '|'
<!---IGNORE 1 LINES--->
(`accountNum`, `billID`, `billDate`, `billData`);
</cfquery>
</cfloop>
<cfquery name="fixbillDate" datasource="#application.billsDsnName#" username="#application.billsDsnUser#" password="#application.billsDsnPass#">
UPDATE ccos_bills SET dateCreated = '#DateFormat(now(), "yyyy-mm-dd")#' WHERE dateCreated IS NULL
</cfquery>
<!---***********************************************************************************--->

How can I call a function in another CFC file from within a query of a function in one cfc file?

I have one cfc file (info.cfc) with multiple functions as shown below.
<cfcomponent output="true" extends="DateFunctions">
<cffunction name="getStatuses" access="remote" returntype="any" output="true" returnformat="plain">
...
</cffunction>
<cffunction name="viewDate" access="remote" returntype="any" output="true" returnformat="plain">
<cfquery name="records">
SELECT
dbo.tickets.Incident,
dbo.tickets.Start_Date,
dbo.tickets.Days_Due
FROM
dbo.tickets
</cfquery>
</cffunction>
</component>
And the other cfc file (DateFunctions.cfc) containing the a function with two arguments and returning a date.
The DateFunctions.cfc file is as follows:
<cfcomponent output="true" name="DateFunctions"">
<cffunction name="addBusinessDays" access="remote" returntype="any" output="true" returnformat="plain">
<cfargument name="daysToAdd"
required="yes"
type="numeric"
hint="The number of whole business days to add or subtract from the given date">
<cfargument name="date"
required="No"
type="date"
hint="The date object to start counting from.."
default="#NowDateTime#">
...
... <!--- Perform some tasks --->
<cfreturn Date>
</cffunction>
</cfcomponent>
Question: How can I invoke "addBusinessDays" from within the query in (info.cfc) also producing another column of results.
I thought I might have been able to do something like:
<cffunction name="viewDate" access="remote" returntype="any" output="true" returnformat="plain">
<cfquery name="records">
SELECT
dbo.tickets.Incident,
dbo.tickets.Start_Date,
dbo.tickets.Days_Due,
(
<cfinvoke component="DateFunctions" method="addBusinessDays" returnVariable="Date">
<cfinvokeargument name="daysToAdd" value="#dbo.tickets.Days_Due#">
<cfinvokeargument name="date" value="#dbo.tickets.Start_Date#">
</cfinvoke>
) AS Due_DATE
FROM
dbo.tickets
</cfquery>
</cffunction>
You could do the following with the caveat of there would be additional processing for the loop.
Edit: Per discussion below, updated cfoutput to cfloop
<cffunction name="viewDate" access="remote" returntype="any" output="true" returnformat="plain">
<cfquery name="records">
SELECT
dbo.tickets.Incident,
dbo.tickets.Start_Date,
dbo.tickets.Days_Due,
'' as Due_DATE
FROM
dbo.tickets
</cfquery>
<cfset df = createobject("component","DateFunctions")>
<cfloop query="records">
<cfset records.Due_DATE = df.addBusinessDays(Days_Due, Start_Date)>
</cfloop>
<cfreturn records>
</cffunction>
Rather than creating the df object, it should be tied to the this scope. That way the object is created only once. This should make the viewDate function run faster as there is no overhead in creating df.
Also, new is just a cleaner syntax
<cfcomponent>
<cfset this.df = new DateFunctions()>
<cffunction name="viewDate" access="remote" returntype="any" output="false" returnformat="plain">
<cfquery name="Local.records">
SELECT
dbo.tickets.Incident,
dbo.tickets.Start_Date,
dbo.tickets.Days_Due,
CAST(NULL AS datetime)
FROM
dbo.tickets
</cfquery>
<cfloop query="Local.records">
<cfset Local.records.Due_DATE = this.df.addBusinessDays( Local.records.Days_Due, Local.records.Start_Date)>
</cfloop>
<cfreturn Local.records>
</cffunction>
<cfcomponent>

coldfusion create list from query results

I am currently using Binding to grab values from a database. Depending on what the user selects from a pull down it shows the results from the database. Currently I am able to show one result but I need to show multiple results if the query brings back more then 1 value. Here is my current code.
<cffunction name="getServiceType" access="remote" returnType="array">
<cfargument name="CATG_NAME" type="string" required="true">
<cfset var data="">
<cfset var result=ArrayNew(2)>
<cfset var i=0>
<cfquery name="getServiceType" datasource="#dsource#">
select distinct SRTY_NAME
from Somedatabase
where (CATG_SPRS_NAME = <cfqueryparam value="#ARGUMENTS.CATG_NAME#" cfsqltype="cf_sql_varchar"> OR CATG_DEPT_SPRS_NAME = <cfqueryparam value="#ARGUMENTS.CATG_NAME#" cfsqltype="cf_sql_varchar">) AND EVLN_REQD_FLAG IS NOT NULL
order by SRTY_NAME
</cfquery>
<cfloop index="i" from="1" to="#getServiceType.recordcount#">
<cfset result[i][1]=getServiceType2.SRTY_NAME[i]>
<cfset result[i][2]=getServiceType2.SRTY_NAME[i]>
</cfloop>
<cfreturn result>
</cffunction>
This generates the 1st pull down list
<cffunction name="getUnion" access="remote" returnType="array">
<cfargument name="SRTY_NAME" type="string" required="true">
<cfset var result=ArrayNew(1)>
<cfquery name="union_rq" datasource="#dsource#">
select U.UNI_NAME, S.SRTY_NAME
from Somedatabase U JOIN Someotherdatabase S ON U.SRTY_NBR = S.SRTY_NBR
where S.SRTY_NAME = <cfqueryparam value="#ARGUMENTS.SRTY_NAME#" cfsqltype="cf_sql_varchar">
</cfquery>
<cfset result[1]=union_rq.UNI_NAME>
<cfreturn result>
</cffunction>
The first list would have an option list Hotel Training and the second query should show both Maids and Cooks. Right now it only shows Maids. I tried to create a list or another array but have not be able to get it to display the results. Below is my Coldfusion call for the display. It is fine to display with commas between the results like Maids,Cooks
<tr id="union">
<td></td>
<td>Union Attached:
<cfinput name="uni_name"
bind="cfc:servicetype.getUnion({service_type})"
bindonload="false"
/></td></tr>
Any advice would be greatly appreicated.