Sure. Here's sample code. I've tested it, it works.
<@Assign Local$SpacedArray <@ARRAY VALUE="A;B;C; ; ;D;E; ;F; ;G;H;">>
Spaced Array Begins as = <@Var Local$SpacedArray><p>
<@Assign Local$RowCount <@Numrows Array=Local$SpacedArray>>
<@Assign Local$Ptr 1>
<@FOR START="1" STOP="<@Var Local$RowCount>">
<@IFEMPTY VALUE="<@Trim Str=<@Var Local$SpacedArray[<@Currow>,1]>>">
<@ELSE>
<@Assign Local$SpacedArray[<@Var Local$Ptr>,1] <@Var
Local$SpacedArray[<@Currow>,1]>>
<@IF EXPR="<@Currow>!=<@Var Local$Ptr>">
<@Assign Local$SpacedArray[<@Currow>,1] ' '>
</@IF>
<@Assign Local$Ptr <@Calc EXPR="<@Var Local$Ptr>+1">>
</@IF>
</@FOR>
Spaced Array now = <@Var Local$SpacedArray><p>
<@Assign Local$Ptr <@Calc EXPR="<@Var Local$Ptr>">>
<@Comment>Delete Remaining blank rows in the Array</@Comment>
<@FOR START="<@Var Local$Ptr>" STOP="<@Var Local$RowCount>">
<@Delrows Array=Local$SpacedArray>
</@FOR>
Spaced Array now = <@Var Local$SpacedArray><p>
Hope this helps!
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Sent: Tuesday, July 27, 2004 9:50 AM
To: [EMAIL PROTECTED]
Subject: RE: Witango-Talk: ARRAY??
Hey Gene,
I have been trying to wrap my arms around this one. Do you have a
simple example you could show/send me? For some reason the second
loop never counts.
Also,
is it possible to do this using the <@for> tag?
Thanks for any help.
>May I suggest a solution? Introduce another variable called Ptr.
>Initialize it to one. Walk through your loop testing each element
>for values. For examining array fields for nulls I typically use
><@Trim Str="<@Var...
>
> Now, if you do NOT find the array element empty increment Ptr by
>one. As long as the array elements have valid values Ptr will keep
>pace with your look counter. When the first empty spot is detected
>both counters will be the same.
>
> At the bottom of the loop you test to see the array element
>pointed to by your loop index is empty. If not, test to see if loop
>index and Ptr are the same. If so, do nothing. If not, assign the
>element pointed at by your loop variable to the location pointed at
>by Ptr and empty the element pointed at by your loop counter. Then
>increment your loop counter and Ptr. When you run across an empty
>cell, with your loop counter, you do not increment Ptr.
>
> This will collapse all of the empty space out of your array and
>condense it at the end of your array.
>
> It is complicated to explain but very easy to do. A small loop
>and a couple of if statements.
>
>-----Original Message-----
>From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
>Sent: Wednesday, July 21, 2004 4:20 PM
>To: [EMAIL PROTECTED]
>Subject: Witango-Talk: ARRAY??
>
>
>Okay,
>
>I'm tired and crabby and need help. This should be simple, but for
>some reason, I am just not seeing it.
>
>I have variables that I am populating with small amounts of text.
>They are named ...
>
><@VAR lcell1> = test1
><@VAR lcell2> =
><@VAR lcell3> = test3
><@VAR lcell4> = test4
>etc.
>etc.
>etc.
>
>Let's just stop at 4 for now to keep this simple (simple is good! Good simple)
>
>Now I created a loop and a counter that counts up to 4 and I have
>added this in the loop...
>
><@IFEMPTY <@VAR 'lcell<@VAR l_counter>'>>
><@ELSE>
><@ASSIGN NAME="llcell<@VAR l_counter>" VALUE="<@VAR 'lcell<@VAR l_counter>'>">
></@IF>
>
>And when I display the results I can see the values correctly. It is
>working as expected BUT I would like to skip the counter on every
><@VAR lcell that is empty. I other words, If <@VAR lcell2> is empty,
>move the values from <@VAR lcell3> into <@VAR lcell2> and also move
>the values from <@VAR lcell4> into <@VAR lcell3>. Is this making
>sense? I would like to get all the variables named 1, 2, 3, 4 etc.
>with no empty variables between.
>
>The final result should be a list of numbered variable that contain
>no empty variables or empty variables in the end...
>
>Original Variables...
>
><@VAR lcell1> = test1
><@VAR lcell2> =
><@VAR lcell3> = test3
><@VAR lcell4> = test4
>
>Modified Variables
>
><@VAR llcell1> = test1
><@VAR llcell2> = test3
><@VAR llcell3> = test4
><@VAR llcell4> =
>
>Thanks
>
>There's gotta be an easy way to do this
>
>________________________________________________________________________
>TO UNSUBSCRIBE: Go to http://www.witango.com/developer/maillist.taf
>________________________________________________________________________
>TO UNSUBSCRIBE: Go to http://www.witango.com/developer/maillist.taf
________________________________________________________________________
TO UNSUBSCRIBE: Go to http://www.witango.com/developer/maillist.taf
________________________________________________________________________
TO UNSUBSCRIBE: Go to http://www.witango.com/developer/maillist.taf