Re: Making a 6 Column Array from a 13 column array

Thanks to all who contributed with this solution.
I was able to create a 6 column Array out of a 13 column Array without 
using the <@ARRAY> or <@ADDROWS> tags.
I also have turned the little six column array into a nifty Excel 
spreadsheet that does mailing labels. Client was thrilled.

I used David Shelley's suggestion on transposing as the most efficient 
solution.
His suggestion was:
"One way would be to transpose the array, delete rows 13,12,11,10,9 and 1,
then transpose the array back again."
For those who wondered why I wanted to tack on a <@CRLF> at the end of each 
row.
The reason was to include the data into a spreadsheet.


Thanks also to Eric Weidl,Ben Johansen,Joanna Ruth Wirtz and Robert Garcia.

My very Best Regards to all,

Brian Mowers

My Final Solution is:

<!--Keep blank Rows out of Results Page-->
<@Exclude>
<!--Turn 13 Column ResultSet Array into 6 Column Array 
(Fname,Lname,Address,City,State,Zipcode)-->
<!--Basically we turn the 13 column array on its side with <@Transpose>, 
then delete (rows) we don't want then <@transpose> again.-->
<@ASSIGN local$MailArray Value=@@Resultset>
  <@ASSIGN NAME="13ColumnArray" VALUE="<@ARRAY ROWS='13' 
COLS='<@NumRows>'>" scope=Local>
  <@ASSIGN NAME="6ColumnArray" VALUE="<@ARRAY ROWS='<@NumRows>' COLS='6'>" 
scope=Local>
<@ASSIGN NAME="13ColumnArray" VALUE='<@TRANSPOSE ARRAY="MailArray" 
SCOPE="local">'>
<@DELROWS ARRAY="13ColumnArray" POSITION=9 NUM=5 SCOPE="local">
<@DELROWS ARRAY="13ColumnArray" POSITION=1 NUM=1 SCOPE="local">
<@DELROWS ARRAY="13ColumnArray" POSITION=3 NUM=1 SCOPE="local">
<@ASSIGN NAME="6ColumnArray" VALUE='<@TRANSPOSE ARRAY="13ColumnArray" 
SCOPE="local">'>
<!--We now have the 6 Column Array that we want-->
<!--Now tack on a <@CRLF> on the end of each Row so we can load into a 
spreadsheet-->
<@FOR START=1 STOP=<@NumRows>>
  <@Assign local$PlusCRLF_<@Currow> 
VALUE="@@6ColumnArray[<@CURROW>,1],@@6ColumnArray[<@CURROW>,2],@@6ColumnArray[<@CURROW>,3],@@6ColumnArray[<@CURROW>,4],@@6ColumnArray[<@CURROW>,5],@@6ColumnArray[<@CURROW>,6]<@CHAR
 
13><@CHAR 10>">
</@FOR>
<@Assign Local$BigString Value="">
<@FOR START=1 STOP=<@NumRows>>
   <@Assign Local$BigString VALUE="<@VAR local$BigString><@VAR 
local$PlusCRLF_<@Currow>>">
</@FOR>
<!--Join rows together into variable for inclusion into HTTP header-->
<!--HTTP Header and data below, local$BigString is our 6 column array data-->
<@ASSIGN LOCAL$encodeResults FALSE>
<@ASSIGN LOCAL$fileName value="<@ARG DownloadFileName>">
<@ASSIGN LOCAL$contentType 
value="Content-Type:application/octet-stream;"></@exclude><@ASSIGN 
LOCAL$fileContents value="<@var local$Bigstring>"><@ASSIGN local$httpHeader 
"HTTP/1.0 200 OK<@CHAR 10><@CHAR 13>MIME-Version:1.0<@CHAR 10><@CHAR 
13>Content-Type:application/vnd.ms-excel;name=<@VAR LOCAL$fileName 
ENCODING=NONE><@CHAR 10><@CHAR 
13>Content-Disposition:attachment;filename=<@VAR LOCAL$fileName 
ENCODING=NONE><@CHAR 10><@CHAR 13>Content-Length:<@VARINFO 
LOCAL$fileContents SIZE><@Crlf><@Crlf>"><@VAR LOCAL$fileContents ENCODING=NONE>

________________________________________________________________________
TO UNSUBSCRIBE: send a plain text/US ASCII email to [EMAIL PROTECTED]
                with unsubscribe witango-talk in the message body

Reply via email to