Very good Rick.

I had ended up with something similar, but your way is much slicker. I was actually messing with the <@CALC> tag for the naming. It got ugly.

Thanks!

WebDude


Hey Webdude,

I totally understand what you need. I've done this before.

Here's the taf with the code on how to do it.

Also, follow this link to see the results:
www.webenergy-sw.com/arraytest.taf

Rick Sanders
Vice President of I.T.
Webenergy-Icantec
Kitchener - Waterloo:(519) 741-2117
Montreal: (514) 808-0788
www.webenergy-sw.com
www.icantec.ca

----- Original Message -----
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, July 27, 2004 2:11 PM
Subject: RE: Witango-Talk: ARRAY??


 Hi Gene and Dave,

 Thanks for the snips. They both work well. Unfortunately, I already
 have gotten this far. I understand how to assign and filter arrays.

 Maybe I should explain myself more fully...

 It's not the values I am concerned about, but the naming of
 individual variables in ascending order. I need the final result
 taken out of the array and put into individual variables named
 whatever1, whatever2, whatever3 and so on with no variables being
 empty. So in your example. I would nee variables with no null
 variables named spaced1, spaced2 spaced3 and so on.

 Example

 (original array)
 A (row1)
 B (row2)
 C (row3)
     (row4)
     (row5)
 D (row6)
 E (row7)
     (row8)
 F (row9)
     (row10)
 G (row11)
 H (row12)

 (what I need)
 <@ASSIGN spaced1 "A">
 <@ASSIGN spaced2 "B">
 <@ASSIGN spaced3 "C">
 <@ASSIGN spaced4 "D">
 <@ASSIGN spaced5 "E">
 <@ASSIGN spaced6 "F">
 <@ASSIGN spaced7 "G">
 <@ASSIGN spaced8 "H">

 The reason I need these variables named this way is because I am
 going to pass them as hidden arguments to an ASP program that writes
 out a business card. Now it would look funny if the cards had blank
 lines in them. Yet I need to name the cells in Acrobat specifically
 for each line on the card. So if a person wants their name, address
 and email but not there phone or fax, the args passed would go to the
 top cells.

 Business Card Cells on original card

 ____Name_________(Named spaced1)
 _____Address1_____(Named spaced2)
 _____Address2_____(Named spaced3)
 _____City, State Zip_ (Named spaced4)
 _____phone________(Named spaced5)
 _____fax__________(Named spaced6)
 _____email_________(Named spaced7)
 _____cell__________(Named spaced8)
 _____route________(Named spaced9)
 _____whatever_____(Named spaced10)

 would turn into...
 ____Name__________(Named spaced1)
 ______Address1_____(Named spaced2)
 ______Address2_____(Named spaced3)
 _____City, State Zip__(Named spaced4)
 ______email________(Named spaced5)
 ______(blank)_______(Named spaced6)
 ______(blank)_______(Named spaced7)
 ______(blank)_______(Named spaced8)
 ______(blank)_______(Named spaced9)
 ______(blank)_______(Named spaced10)

 Is this making sense???







 >Another way to do the same thing would be to use the filter tag:
 >
 ><@Assign Local$SpacedArray <@ARRAY VALUE="A;B;C; ; ;D;E; ;F; ;G;H;">>
 >Spaced Array Begins as = <@Var Local$SpacedArray><p>
 ><@Assign local$SpacedArray <@filter array=local$SpacedArray
 >expr="len(<@trim str='#1'>)">>
 >Spaced Array now = <@Var Local$SpacedArray><p>
 >
 >Dave Shelley
 >
 >-----Original Message-----
 >From: Wolf, Gene [mailto:[EMAIL PROTECTED]
 >Sent: Tuesday, July 27, 2004 1:05 PM
 >To: [EMAIL PROTECTED]
 >Subject: RE: Witango-Talk: ARRAY??
 >
 >    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
 >
 >________________________________________________________________________
 >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

Content-Type: application/octet-stream;
        name="arraytest.taf"
Content-Disposition: attachment;
        filename="arraytest.taf"

Attachment converted: MediaBlitz2:arraytest.taf (????/----) (00001610)

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

Reply via email to