[Zope] How to transpose a 2-D array?
Jason Wong
jwong@digitalview.com.hk
Fri, 5 May 2000 12:28:27 +0800
Question: How do I transpose the contents of a 2-D array?
Purpose: I have a ZSQL-Method which returns the rows (Model 1, Model 2 etc)
as in Diagram 1 below (best viewed in a fixed-width font). I want to present
this information in an HTML table as in Diagram 2 below.
Diagram 1
=========
Model | Feature 1 | Feature 2 | Feature 3 | Feature 4
--------+-----------+-----------+-----------+-----------
Model 1 | Yes | Yes | Yes | No
--------+-----------+-----------+-----------+-----------
Model 2 | Yes | Yes | No | No
--------+-----------+-----------+-----------+-----------
Model 3 | No | Yes | No | Yes
Diagram 2
=========
| Model 1 | Model 2 | Model 3
----------+---------+---------+---------
Feature 1 | Yes | Yes | No
----------+---------+---------+---------
Feature 2 | Yes | Yes | Yes
----------+---------+---------+---------
Feature 3 | Yes | No | No
----------+---------+---------+---------
Feature 4 | No | No | Yes
tia
-
Jason Wong
Digital View Ltd
2201 Nanyang Plaza
57 Hung To Road
Kwun Tong
HONG KONG
Tel: +852-2861-3615
Fax: +852-2520-2987
www.digitalview.com