If this is coming to you as a list (not a table) and you want to show the list in a table format like you described below then try this code:

<@! COMMENT="Define the list">
<@ASSIGN SCOPE='local' NAME='List' VALUE='<@TOKENIZE VALUE="1 2 3 4 5 6 7 8 9 10 11 12 13 14" CHARS="<@CHAR 32>">'>
<@! COMMENT="Define the number of columns">
<@ASSIGN SCOPE='local' NAME='NumCols' VALUE='3'>

<@! COMMENT="Create an array with the correct number of columns and rows, calculate the number of rows based on the columns">
<@ASSIGN SCOPE='local' NAME='Array' VALUE='<@ARRAY ROWS="<@CALC 'ceil((<@NUMROWS ARRAY="List"><@NUMCOLS ARRAY="List">)/<@VAR NumCols>)'>" COLS="<@VAR NumCols>">'>

<@! COMMENT="Initialize the counters">
<@ASSIGN SCOPE='local' NAME='CurrentRow' VALUE='1'>
<@ASSIGN
SCOPE='local' NAME='CurrentCol' VALUE='1'>
<@ROWS ARRAY='List'>
        <@COLS>
                <@! COMMENT="Assign the current value to the right place in the array">
                <@ASSIGN SCOPE='local' NAME='Array[<@VAR CurrentRow>,<@VAR CurrentCol>]' VALUE='<@VAR NAME=List[<@CURROW>,<@CURCOL>]>'>

                <@! COMMENT="Increment or reset the appropriate counters">
                <@IFEQUAL <@VAR CurrentRow> <@NUMROWS ARRAY='Array'>>
                        <@ASSIGN SCOPE='local' NAME='CurrentCol' VALUE='<@CALC "<@VAR CurrentCol> + 1">'>
                        <@ASSIGN SCOPE='local' NAME='CurrentRow' VALUE='1'>
                <@ELSE>
                        <@ASSIGN SCOPE='local' NAME='CurrentRow' VALUE='<@CALC "<@VAR CurrentRow> + 1">'>
                </@IF>
        </@COLS>
</@ROWS>
<@! COMMENT="Display the result">
<@VAR NAME='Array'>

 
BTW, the VAR 'List' can also be an array, and this will work, but it will pad the array to the value of  'ceil((<@NUMCOLS ARRAY="List">*<@NUMROWS ARRAY="List">)/<@VAR NumCols>)'
ie, try these value for list:

<@ASSIGN SCOPE='local' NAME='List' VALUE='<@ARRAY VALUE="1,2,3,4;5,6,7,8;9,10,11,12;13,14,,;">'> (18)

<@ASSIGN SCOPE='local' NAME='List' VALUE='<@ARRAY VALUE="1,2,3;4,5,6;7,8,9;10,11,12;13,14,;">'> (15)

Tom, assign the column to the List var like so:

<@ASSIGN SCOPE=local NAME=List VALUE=<@VAR ResultSet[*, MyColumn]>>

See attached for working sample code.

Anthony -



-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]]On Behalf Of Tom Carr
Sent: Monday, May 13, 2002 3:18 PM
To: Multiple recipients of list witango-talk
Subject: Witango-Talk: Arranging a table vertically, not horizontally


I am wanting to take the data coming out of a search and dynamically put the
data in an html table vertically rather than horizontally like this:

1     6     11
2     7     12
3     8     13
4     9     14
5     10


Rather than this:
1     2     3
4     5     6
7     8     9
10    11    12
13    14

Anyone got a snippet to get me started here?
I used to use the <MULTICOL> tag, but that is long since unsupported...
Trying to recreate that functionality wiTango.

Attachment: test2.taf
Description: Binary data

Reply via email to