Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Lists 1

Status
Not open for further replies.

fiber0pti

ISP
Nov 22, 2000
96
US
I have a problem making a list. I can't create the list before I need it though or from a query becuase I have a grouped cfoutput. My code works perfect accept the javascript doesn't like the last "," after the last record. Could someone help.

Code:
var CategoryArray = new Array();
var CategoryValueArray = new Array();
CategoryArray[0] = '';
CategoryValueArray[0] = '';
<CFSET i = 1>
<CFOUTPUT QUERY = &quot;GetCategories&quot; GROUP = &quot;CatNum&quot;>
CategoryArray[#i#] = new Array(<CFOUTPUT>'#SubCatDesc#',</CFOUTPUT>);
CategoryValueArray[#i#] = new Array (<CFOUTPUT>'#SubCatNum#',</CFOUTPUT>);
<CFSET i = i + 1>
</CFOUTPUT>
 
Hey fiberopti,

I haven't tested this but I think this might do what you need. I assume you're basically trying to avoid the &quot;,&quot; after the last record.

<CFSET i = 1>
<CFOUTPUT QUERY = &quot;GetCategories&quot; GROUP = &quot;CatNum&quot;>
CategoryArray[#i#] = new
<cfset showCom = 0>
Array(<CFOUTPUT>
<cfif showCom is 1>,</cfif>
'#SubCatDesc#'
<cfset showCom =1>
</CFOUTPUT>);
CategoryValueArray[#i#] = new Array
<cfset showCom = 0>
(<CFOUTPUT>
<cfif showCom is 1>,</cfif>
'#SubCatNum#'
<cfset showCom =1>
</CFOUTPUT>);
<CFSET i = i + 1>
</CFOUTPUT>

Hope this helps,
GJ
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top