Off the top of my head, if the datebox field is empty, the list will begin with a , ... so even though you've replaced ,, with , , before creating your array, that first element may be removed during a listtoarray() function call... so you might want to try adding a , before #datebox# where you're creating your lists...
I'm inclined to think it might be more efficient to create a single query with a union and then just loop over the query rather than creating separate queries and then populating an array with them... There's nothing necessarily wrong with the code you have, but I thought I might throw that suggestion out. :) hth s. isaac dealey Original Message ----------------------- I've got this array (below) that pulls the results from a variety of tables, and displays results based on the list position. The problem is with frwhatsnewresearch. The list position for 3 SHOULD be 'frname' and the list position for position 6 SHOULD be 'id'. This does not display the right results. If I make the change to 4 and 7, it works... but I don't understand why. Can anybody help me out with this one? I'm -completely- open to rewriting this so it's more efficient/works properly, if anybody has any suggestions. -- Jillian *** *** *** <cfquery name="frwhatsnewlink" datasource="cts"> SELECT id, name, frname, url, frurl, datebox FROM link WHERE link.include = 'yes' AND datebox >= #now()# </cfquery> <cfquery name="frwhatsnewgs" datasource="cts"> SELECT id, title AS name, frtitle AS frname, datebox FROM gs WHERE gs.include = 'yes' AND datebox >= #now()# </cfquery> <cfquery name="frwhatsnewevents" datasource="cts"> SELECT id, title AS name, frtitle AS frname, url, frurl, datebox FROM events WHERE events.include = 'yes' AND datebox >= #now()# </cfquery> <cfquery name="frwhatsnewprof" datasource="cts"> SELECT id, title AS name, frtitle AS frname, url, frurl, datebox FROM professional WHERE professional.include = 'yes' AND datebox >= #now()# </cfquery> <cfquery name="frwhatsnewresearch" datasource="cts"> SELECT id, title AS name, frtitle AS frname, url, frurl, datebox FROM research WHERE research.include = 'yes' AND datebox >= #now()# </cfquery> <cfscript> pound = chr(35); // ascii for "#" character </cfscript> <cfset frwhatsnew = arraynew(1)> <cfset i=0> <p> <cfloop Query="frwhatsnewlink"> <cfset i = i + 1> <cfset frwhatsnew[i] = "#datebox#,#name#,#frname#,#url#,#frurl#,#id#,link"> <cfset frwhatsnew[i] = replace(frwhatsnew[i], ",,", ", ,", "ALL")> </cfloop> <cfloop Query="frwhatsnewgs"> <cfset i = i + 1> <cfset frwhatsnew[i] = "#datebox#,#name#,#frname#,#id#,gs"> <cfset frwhatsnew[i] = replace(frwhatsnew[i], ",,", ", ,", "ALL")> </cfloop> <cfloop Query="frwhatsnewevents"> <cfset i = i + 1> <cfset frwhatsnew[i] = "#datebox#,#name#,#frname#,#url#,#frurl#,#id#,events"> <cfset frwhatsnew[i] = replace(frwhatsnew[i], ",,", ", ,", "ALL")> </cfloop> <cfloop Query="frwhatsnewprof"> <cfset i = i + 1> <cfset frwhatsnew[i] = "#datebox#,#name#,#frname#,#url#,#frurl#,#id#,professional"> <cfset frwhatsnew[i] = replace(frwhatsnew[i], ",,", ", ,", "ALL")> </cfloop> <cfloop Query="frwhatsnewresearch"> <cfset i = i + 1> <cfset frwhatsnew[i] = "#datebox#,#name#,#frname#,#url#,#frurl#,#id#,research"> <cfset frwhatsnew[i] = replace(frwhatsnew[i], ",,", ", ,", "ALL")> </cfloop> <cfset isSuccessful = ArraySort(frwhatsnew, "textnocase", "desc")> <img src="/cts/fr/images/quoi_de_neuf.gif" /><br clear="left" /> <table bgcolor="000000" border="0" cellspacing="0" cellpadding="0" width="160"> <tr> <td> <table bgcolor="000000" border="0" cellspacing="1" cellpadding="1" width="160"> <cfoutput> <cfloop index="K" from="1" to="#i#"> <CFIF ListLast(frwhatsnew[k]) EQ "link"> <cfif len(listgetat(frwhatsnew[k],3,",")) GT 1> <tr><td bgcolor=ddd9ea class="smtext">#ListGetAt(frwhatsnew[k],3)#<a href=" <http://#ListGetAt(frwhatsnew[k],5> http://#ListGetAt(frwhatsnew[k],5)#" class="smtext"> >> </a></td></tr> <cfelse> <tr><td bgcolor=ddd9ea class="smtext">#ListGetAt(frwhatsnew[k],2)#<a href=" <http://#ListGetAt(frwhatsnew[k],4> http://#ListGetAt(frwhatsnew[k],4)#" class="smtext"> >> </a></td></tr> </cfif> <cfelse> <CFIF ListLast(frwhatsnew[k]) EQ "gs"> <cfif len(listgetat(frwhatsnew[k],3,",")) GT 1> <tr><td bgcolor=ddd9ea class="smtext">#ListGetAt(frwhatsnew[k],3)#<a href=http://www.lung.ca/cts/fr/directives.cfm#pound##ListGetAt(frwhatsnew[k] ,4)# class="smtext"> >> </a></td></tr> <cfelse> <tr><td bgcolor=ddd9ea class="smtext">#ListGetAt(frwhatsnew[k],2)#<a href=http://www.lung.ca/cts/fr/directives.cfm#pound##ListGetAt(frwhatsnew[k] ,4)# class="smtext"> >> </a></td></tr> </cfif> <cfelse> <CFIF ListLast(frwhatsnew[k]) EQ "events"> <cfif len(listgetat(frwhatsnew[k],3,",")) GT 1> <tr><td bgcolor=ddd9ea class="smtext">#ListGetAt(frwhatsnew[k],3)#<a href=http://www.lung.ca/cts/fr/evenements.cfm#pound##ListGetAt(frwhatsnew[k] ,6)# class="smtext"> >> </a></td></tr> <cfelse> <tr><td bgcolor=ddd9ea class="smtext">#ListGetAt(frwhatsnew[k],2)#<a href=http://www.lung.ca/cts/fr/evenements.cfm#pound##ListGetAt(frwhatsnew[k] ,6)# class="smtext"> >> </a></td></tr> </cfif> <cfelse> <CFIF ListLast(frwhatsnew[k]) EQ "professional"> <cfif len(listgetat(frwhatsnew[k],3,",")) GT 1> <tr><td bgcolor=ddd9ea class="smtext">#ListGetAt(frwhatsnew[k],3)#<a href=http://www.lung.ca/cts/fr/professionnel.cfm#pound##ListGetAt(frwhatsnew [k],6)# class="smtext"> >> </a></td></tr> <cfelse> <tr><td bgcolor=ddd9ea class="smtext">#ListGetAt(frwhatsnew[k],2)#<a href=http://www.lung.ca/cts/fr/professionnel.cfm#pound##ListGetAt(frwhatsnew [k],6)# class="smtext"> >> </a></td></tr> </cfif> <cfelse> <CFIF ListLast(frwhatsnew[k]) EQ "research"> <cfif len(listgetat(frwhatsnew[k],3,",")) GT 1> <tr><td bgcolor=ddd9ea class="smtext">#ListGetAt(frwhatsnew[k],3)#<a href=http://www.lung.ca/cts/fr/recherche.cfm#pound##ListGetAt(frwhatsnew[k], 6)# class="smtext"> >> </a></td></tr> <cfelse> <tr><td bgcolor=ddd9ea class="smtext">#ListGetAt(frwhatsnew[k],2)#<a href=http://www.lung.ca/cts/fr/recherche.cfm#pound##ListGetAt(frwhatsnew[k], 6)# class="smtext"> >> </a></td></tr> </cfif> </cfif></cfif></cfif></cfif></cfif> </cfloop> </cfoutput> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4 Subscription: http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4 FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Signup for the Fusion Authority news alert and keep up with the latest news in ColdFusion and related topics. http://www.fusionauthority.com/signup.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

