What's wrong, here? Everything is fine down to the ArraySort. As you can see, I test DocTypeArray to make sure it is an array and contains what I think it does. It tests "true" as an array, and it does contain the right data. When I try to sort the array, I don't get an error on the sort, but SortedDocArray tests "no" as an array.
I've tried every permutation I can think of,including declaring SortedDocArray before the sort,quotes and no quotes, ## and no ## , etc., but I get the same result. What am I missing?
Calista :-X
Jedi Knight,
Champion of the Force
I've tried every permutation I can think of,including declaring SortedDocArray before the sort,quotes and no quotes, ## and no ## , etc., but I get the same result. What am I missing?
Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE>Test Query</TITLE>
</HEAD>
<BODY>
<CFPARAM NAME="DocNameList" DEFAULT="">
<!--- Here is the list. --->
<CFSET DOCTYPELIST = "1,2,3,4,7,10,11">
<BR>
<!--- Now, I am creating a list of the DocType names. --->
<CFLOOP INDEX="DocTypeIndex" LIST="#DocTypeList#">
<CFQUERY NAME="GetDocTypes"
DATASOURCE="#Application.Datasource#"
DBTYPE="ODBC">
SELECT *
FROM DocTypeTable
WHERE DocTypeID = #DocTypeIndex#
</CFQUERY>
<CFOUTPUT QUERY="GetDocTypes">#DocType#<BR></CFOUTPUT>
<CFSET DocNameList = #ListAppend(DocNameList,GetDocTypes.DocType)#>
</CFLOOP>
<BR><BR>
<CFOUTPUT>#DocNameList#</CFOUTPUT>
<BR><BR>
<!--- Create an array. --->
<CFSET DocTypeArray = #ArrayNew(1)#>
<!--- Convert list to array. --->
<CFSET DocTypeArray = #ListToArray(DocNameList)#>
<CFIF #IsArray(DocTypeArray)# EQ "Yes">
DocTypeArray is an Array.<BR><BR>
<CFELSE>
DocTypeArray is NOT an array.<BR><BR>
</CFIF>
<CFLOOP INDEX="ArrayIndex" FROM="1" TO="7" STEP="1">
<CFOUTPUT>#DocTypeArray[ArrayIndex]#<BR></CFOUTPUT>
</CFLOOP>
<BR><BR>
<!--- Sort the array. --->
<CFSET SortedDocArray = ArraySort(DocTypeArray,"textnocase","asc")>
<CFIF #IsArray(SortedDocArray)# EQ "Yes">
SortedDocArray is an Array.<BR><BR>
<CFELSE>
SortedDocArray is NOT an array.<BR><BR>
</CFIF>
<!---
<CFOUTPUT>#SortedDocArray[1]#</CFOUTPUT><BR><BR>
<!--- Convert the array back to a list. --->
<CFSET SortedDocList = #ArrayToList(SortedDocArray)#>
<CFOUTPUT>#SortedDocList#</CFOUTPUT><BR><BR>
--->
</BODY>
</HTML>
Jedi Knight,
Champion of the Force