One of the clever Witango guys suggested this awhile ago and it works in a variety of circumstances if you are trying to specify a kind of delimiter.. I can't take credit for it, but it works great.

<@rows array=myarray><@ifequal "<@currow>" "1"><@else>,</@if><@var myarray[<@currow>,2]></@rows>


On Tuesday, August 26, 2003, at 08:54 AM, Wilcox, Jamileh (HSC) wrote:

Atrix� -� one method you can use is to loop through the rows and build a comma-delimited string.� It's not pretty, but it works.

I think this will do it:
<@assign name="tempvar" scope="local" value = "<@rows array='local$resultset'><@cols><@col>,</@cols></@rows>">

Then trim the extra comma from the end when you assign it to your array:
<@assign local$orders[@@local$vrowcount,5] value="<@left str='@@local$tempvar' numchars='<@calc expr="<@length str=@@local$tempvar>-1">'>">

It's very early & I haven't had any caffeine, so beware of my coding.� ;^)

It seems like I had a similar error a long time ago, but I can't remember why or how I dealt with�it.� A few thoughts that ran thru my head:� What's your column suffix on local$orders?� Could the arrays be getting mixed together?� Have you tried outputting just local$temp to see what's happening there?� Do you need another set of quotes around the comma-delimited string to keep it as one piece?

Good luck!

jamileh



-----Original Message-----
From: Atrix Wolfe [mailto:[EMAIL PROTECTED]
Sent: Monday, August 25, 2003 7:14 PM
To: [EMAIL PROTECTED]
Subject: Witango-Talk: comma delimited list

hello,


im trying to take the results of a query and store it in an element of an array as a comma delimited list.� The problem im having with doing this is a tango error.

I tried this:

<@assign local$orders[@@local$vrowcount,5] value="<@var local$resultset aprefix='' asuffix='' rprefix='' rsuffix='' cprefix='' csuffix=','>">


and i get a tango error:��



Invalid value specified. Previous value has been used.
orders[1,5]

Meta Stack Trace:



<image.tiff>

local$orders[1,5] does exist so i know thats not the problem.


SInce that didnt work i tried assigning it first to a temporary variable like this:
<@assign local$temp value="<@var local$resultset aprefix='' asuffix='' rprefix='' rsuffix='' cprefix='' csuffix=','>"><br><br>

<@assign local$orders[@@local$vrowcount,5] value="@@local$temp">

and i get a tango error like this:

Invalid value specified. Previous value has been used.
orders[1,5]

Meta Stack Trace:



<image.tiff>


It looks like its not really converting it to a comma delimited list when it tries to store it to a different place internaly...anyone know how to get around this?

Thanks!

Atrix

________________________________________________________________________
TO UNSUBSCRIBE: Go to http://www.witango.com/maillist.taf

Reply via email to