a couple of comments
1. first it is != instead of =!
2. POSITION= 0=at the beginning, -1=at the end
you don't need to go <@CURROW>-1
3. all arrays have a Zero (0) row, which usually holds the column names
witango will default start at row 1 when working with arrays.
4. No the <@ROWS> tag will just drive down the array once
if you want to make sure it will stop you could add the attribute
STOP="<@NUMROWS ARRAY='Cat2'>"> to the <@ROWS> meta tag
--corrected (i think) code--
<@ASSIGN NAME="Cat2" VALUE="@@resultSet" SCOPE="User">
<@ROWS ARRAY="Cat2">
<@IF EXPR="@@User$Cat2[<@CURROW>,1] != <@VAR NAME=CatTest SCOPE='Local'>">
<@ASSIGN NAME="temp" ROWS="1" COLUMNS="4" VALUE="<@ARRAY VALUE='<@VAR
NAME=CatTest SCOPE="Local">,99999,All Listing Classes,99999;' CDELIM=','
RDELIM=';'>" SCOPE="Local">
<@ADDROWS ARRAY="Cat2" VALUE="@@Local$temp" POSITION="0" SCOPE="User">
<@DELROWS ARRAY="Cat2" POSITION="<@CURROW>" NUM="1" SCOPE="User">
</@IF>
<@ASSIGN NAME="CatTest" VALUE="@@User$Cat2[<@CURROW>,1]" SCOPE="Local">
</@ROWS>
the above process looks like it will go through all the rows of the Cat2
array and keep adding the data from the @currow to the top of the array. one
problem that it is not deleting the original data at @CURROW. So I added the
@DELROWS command.
I would do this myself, it would put the "All Listing Classes at the top"
<@ASSIGN NAME="Cat2" VALUE="@@resultSet" SCOPE="User">
<@ASSIGN NAME="temp" ROWS="1" COLUMNS="4" VALUE="<@ARRAY VALUE='<@VAR
NAME=CatTest SCOPE="Local">,99999,All Listing Classes,99999;' CDELIM=','
RDELIM=';'>" SCOPE="Local">
<@ADDROWS ARRAY="Cat2" VALUE="@@Local$temp" POSITION="0" SCOPE="User">
you can also sort array using the following command
<@SORT ARRAY=arrayVarName [COLS=sortCol [sortType] [sortDir] [, ...]]
[SCOPE=scope]>
I hope this helps ;-)
-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]]On Behalf Of Fogelson, Steve
Sent: Thursday, June 13, 2002 1:59 PM
To: Multiple recipients of list witango-talk
Subject: Witango-Talk: Code Concern
I was wondering if someone could review this code before I test it. I want
to insert a "All Listing Classes" row as the category (first field in the
array) changes in the array.
<@ASSIGN NAME="Cat2" VALUE="@@resultSet" SCOPE="User">
<@ROWS START=1 STEP=1 ARRAY="Cat2">
<@IF EXPR="@@User$Cat2[<@CURROW>,1] =! <@VAR NAME=CatTest SCOPE='Local'>">
<@ASSIGN NAME="temp" ROWS="1" COLUMNS="4" VALUE="<@ARRAY
VALUE='<@VAR NAME=CatTest SCOPE="Local">,99999,All Listing Classes,99999;'
CDELIM=',' RDELIM=';'>" SCOPE="Local">
<@ADDROWS ARRAY="Cat2" VALUE="@@Local$temp" POSITION="<@CURROW>-1"
SCOPE="User">
</@IF>
<@ASSIGN NAME="CatTest" VALUE="@@User$Cat2[<@CURROW>,1]" SCOPE="Local">
</@ROWS>
Should I start it at 0 instead of 1 as it is an array?
I want to insert a row before the 1st row in the array. If it trys to insert
into <@CURRROW>-1 when the index is 0 or 1, will it do something else?
I'm concerned this code may put my server in an endless loop. When it
inserts a row into <@CURRROW>-1, and the next iteration executes, will it
read the same row it just read because that row was moved up one position?
Thanks
Steve Fogelson
Internet Commerce Solutions
________________________________________________________________________
TO UNSUBSCRIBE: send a plain text/US ASCII email to [EMAIL PROTECTED]
with unsubscribe witango-talk in the message body
________________________________________________________________________
TO UNSUBSCRIBE: send a plain text/US ASCII email to [EMAIL PROTECTED]
with unsubscribe witango-talk in the message body