re: list from array occurences
listVar = left(repeatString(VarChar,, arrayLen(arrayVar)), ((8 * arrayLen(arrayVar)) - 1)); that just creates a list of VarChar,VarChar,VarChar, based on the arrayLen() and then removes the final ,. ~| Want to reach the ColdFusion community with something they want? Let them know on the House of Fusion mailing lists Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:325077 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: list from array occurences
is there a function to do this in a line of code Try this: MyList = RepeatString(,VarChar, arrayLen(MyArray)) The comma at the begining will be considered as an empty element which is ignored by CF. However, if you rather have a clean list, use this: MyList = mid(RepeatString(,VarChar, arrayLen(MyArray)) , 2, ) ~| Want to reach the ColdFusion community with something they want? Let them know on the House of Fusion mailing lists Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:325078 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: list from array occurences
does it have to be just one line? you can loop for the array length and do a list append... cfset myList = / cfloop from=1 to=#arrayLen(myArray)# index=idx cfset myList = listAppend(myList, 'VarChar') / /cfloop On Wed, Jul 29, 2009 at 9:27 AM, Richard White rich...@j7is.co.uk wrote: hi we need to create a list of the string VarChar i.e. VarChar,VarChar,VarChar the amount of list elements is totally dependant on the length of another array which could change. e.g. if theArray length is 3 then the list would be VarChar,VarChar,VarChar else if theArray length is 5 then the list would be VarChar,VarChar,VarChar,VarChar,VarChar etc... is there a function to do this in a line of code thanks ~| Want to reach the ColdFusion community with something they want? Let them know on the House of Fusion mailing lists Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:325079 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Re: list from array occurences
thanks for the replies, this works perfectly listVar = left(repeatString(VarChar,, arrayLen(arrayVar)), ((8 * arrayLen(arrayVar)) - 1)); that just creates a list of VarChar,VarChar,VarChar, based on the arrayLen() and then removes the final ,. ~| Want to reach the ColdFusion community with something they want? Let them know on the House of Fusion mailing lists Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:325080 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: list from array occurences
typeList = removeChars(repeatString(,varchar, arrayLen(myArray)), 1, 1); On Wed, Jul 29, 2009 at 9:27 AM, Richard Whiterich...@j7is.co.uk wrote: hi we need to create a list of the string VarChar i.e. VarChar,VarChar,VarChar the amount of list elements is totally dependant on the length of another array which could change. e.g. if theArray length is 3 then the list would be VarChar,VarChar,VarChar else if theArray length is 5 then the list would be VarChar,VarChar,VarChar,VarChar,VarChar etc... is there a function to do this in a line of code thanks ~| Want to reach the ColdFusion community with something they want? Let them know on the House of Fusion mailing lists Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:325081 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: list from array occurences
Everyone had interesting solutions, but I wonder why you just wouldn't use ArrayTolist() cf-talk@houseoffusion.com on Wednesday, July 29, 2009 at 9:27 AM -0700 wrote: hi we need to create a list of the string VarChar i.e. VarChar,VarChar,VarChar the amount of list elements is totally dependant on the length of another array which could change. e.g. if theArray length is 3 then the list would be VarChar,VarChar,VarChar else if theArray length is 5 then the list would be VarChar,VarChar,VarChar,VarChar,VarChar etc... is there a function to do this in a line of code thanks ~| Want to reach the ColdFusion community with something they want? Let them know on the House of Fusion mailing lists Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:325082 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: list from array occurences
Good call, Barney ... forgot all about the removeChars() function ... haven't used that one in years. Good reminder! ~| Want to reach the ColdFusion community with something they want? Let them know on the House of Fusion mailing lists Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:325083 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: list from array occurences
Randi - Based on how I read the question, the existing array and desired list had nothing in common, other than the length of elements. On Wed, Jul 29, 2009 at 9:56 AM, Randi Knutson rknut...@otan.us wrote: Everyone had interesting solutions, but I wonder why you just wouldn't use ArrayTolist() cf-talk@houseoffusion.com on Wednesday, July 29, 2009 at 9:27 AM -0700 wrote: hi we need to create a list of the string VarChar i.e. VarChar,VarChar,VarChar the amount of list elements is totally dependant on the length of another array which could change. e.g. if theArray length is 3 then the list would be VarChar,VarChar,VarChar else if theArray length is 5 then the list would be VarChar,VarChar,VarChar,VarChar,VarChar etc... is there a function to do this in a line of code thanks ~| Want to reach the ColdFusion community with something they want? Let them know on the House of Fusion mailing lists Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:325084 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Re: list from array occurences
he's not looking for the array element values ... he wants the actual string 'VarChar' once for each element. ~| Want to reach the ColdFusion community with something they want? Let them know on the House of Fusion mailing lists Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:325085 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: list from array occurences
Yet another solution, assuming that the array length is at least 1: MyList = VarChar RepeatString(,VarChar, arrayLen(MyArray) - 1) ~| Want to reach the ColdFusion community with something they want? Let them know on the House of Fusion mailing lists Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:325086 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4