Quantcast
Channel: Adobe Community : Discussion List - ColdFusion
Viewing all articles
Browse latest Browse all 6243

Code Throwing error sometimes.

$
0
0

Hi All,

 

I am using the following code to convert a ColdFusion Query Object to ColdFusion structure to work in Kendo UI datagrid.

 

 

<cffunction name="convertQueryToKendoJSON" access="public" returntype="Struct" hint="Converts a ColdFusion Query Object into Kendo UI format JSON">

          <cfargument name="queryObject" required="true" type="query" hint="ColdFusion Query Object" />

 

          <cfset var returnStruct = structNew() />

          <cfset var tempArray = arrayNew(1) />

 

          <!--- Loop over the query Object and create one structure Object for each row and query fields are the structure keyfields

                    Store the structure into an array Object. --->

          <cfloop query="arguments.queryObject">

                    <cfset tempStruct = structNew() />

 

                    <cfloop list="#arguments.queryObject.columnList#" index="columnName">

                              <cfset tempStruct[columnName] = arguments.queryObject[columnName][arguments.queryObject.currentRow] />

                    </cfloop>

                    <cfset arrayAppend(tempArray, tempStruct) />

          </cfloop>

 

 

          <!--- Store the Array into result key field of the returnStruct --->

          <cfset returnStruct['results'] = tempArray />

 

 

          <!--- If record Count value exists in the query then only set the totalRecords value --->

          <cfif findNoCase("ntRecordCount", arguments.queryObject.columnList)>

                    <cfset returnStruct['totalRecords'] = arguments.queryObject.ntRecordCount />

          </cfif>

 

          <cfreturn returnStruct />

</cffunction>

 

 

 

It is working fine most of the times. But, in some cases when I am getting the query object from a stored Proc call or from QoQ opearation then I am getting the following error.

 

[Table (rows 4 columns NTRECORDCOUNT, NTROWINDEX, NTLEAD_ROUTING_ALGOID, VCROUTING_ALGO, DTCREATED, DTLAST_UPDATED, NTSORT_ORDER): [NTRECORDCOUNT: coldfusion.sql.QueryColumn@10ec6d0] [NTROWINDEX: coldfusion.sql.QueryColumn@11e9be0] [NTLEAD_ROUTING_ALGOID: coldfusion.sql.QueryColumn@8b96e1] [VCROUTING_ALGO: coldfusion.sql.QueryColumn@5e9f7e] [DTCREATED: coldfusion.sql.QueryColumn@3947f5] [DTLAST_UPDATED: coldfusion.sql.QueryColumn@a35419] [NTSORT_ORDER: coldfusion.sql.QueryColumn@e669f3] ] is not indexable by NTSERVICE_TYPEID

 

 

NOTE: I am not getting the error always, sometimes I am getting this error.

 

System Info:

DataBase: MS SQL 2008

CF - ColdFusion  9,0,2,282541 Enterprise Edition


Viewing all articles
Browse latest Browse all 6243

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>