David Schwartz wrote:

is this possible/smart in JSTL



May be possible but not smart.
Should be returned by the database & just displayed by JSTL.
You need a crosstab query. Which database are you using?



I'm using Oracle. I've got a crosstab query going now, but what happens is that I'm getting getting duplicate rows with one row having a null in a certain field and the other with data in the field:


select distinct
x.outlet_no,
building.name,
x.rm,
decode(b.color,NULL,' ',b.color),
decode(b.switchip,NULL,' ',b.switchip) BSWITCHIP,
decode(b.blade,NULL,' ',b.blade) BBLADE,
decode(b.port,NULL,' ',b.port) BPORT,
decode(b.vlan,NULL,' ',b.vlan)  BVLAN,
decode(o.color,NULL,' ',o.color) ,
decode(o.switchip,NULL,' ',o.switchip) OSWITCHIP,
decode(o.blade,NULL,' ',o.blade) OBLADE,
decode(o.port,NULL,' ',o.port) OPORT,
decode(o.vlan,NULL,' ',o.vlan) OVLAN,
decode(g.color,NULL,' ',g.color) ,
decode(g.switchip,NULL,' ',g.switchip) GSWITCHIP,
decode(g.blade,NULL,' ',g.blade) GBLADE,
decode(g.port,NULL,' ',g.port) GPORT,
decode(g.vlan,NULL,' ',g.vlan) GVLAN,
d.dn
from
building,
data b,
data o,
data g,
cablepair d,
new_outlet x
where x.outlet_no = b.outlet_no(+)
and x.outlet_no = o.outlet_no(+)
and x.outlet_no = g.outlet_no(+)
and x.id=d.cabl_pr(+)
and b.color(+) = 'B'
and o.color(+) = 'O'
and g.color(+) = 'G'
and x.buildid=building.id(+)

This will give me outlets of three colors, but the phone (dn) from 'cablepair' will cause duplicate rows. I guess the best way to eliminate this is to union this query against itself for each color, which will be clunky. Thanks for all your input!

- Nic.


Quoting Helios Alonso <[EMAIL PROTECTED]>:



I think he wants a table like this:

+ John (in red)
+ Mark (in blue)
+ Nic (in green)
+ Helios (in red)
+ David (in blue)
....

If you have an array of 3 colors named colors (I dont know but, maybe the
set tag can build a mapping that works like an array...)

Try this:
<!-- initialization -->
<c:set var="colorIndex" value="0"/>
<!-- loop -->
<tr>
<td bgcolor="${colors[colorIndex++%3]}" >

In the expression you're coding the round robin (increment and modulus 3)
and the selection of the color based on the index.

But, I didn't try it.  I hope the modulus is a valid construction in EL.

At 11:05 04/08/2004 +0200, you wrote:


I'm not exactly sure what you mean with "rotate"?!

Do you just have a collection that you want to iterate - with each each
entry corresponding to a "row" in the table? Or shall every row display a
different "column" of your table? It's hard to understand from your


examples..


For displaying tabular data, you should check out the displaytag-library:
http://displaytag.sourceforge.net/  - it has nothing  to with jstl, but
gives you everything you will likely ever need for displaying tables...

cheers
stf

Nic Werner wrote:


Greetings,
  I have a table of data that I'd basically like to rotate, is this
possible/smart in JSTL?
Basically, I have an attribute with three colors, each one is a
different row in a table.
001 Blue data
001 Green data
002 Purple data
I want to have one row:001 | Blue Data | Green Data | Purple Data.
Any suggestions? Please help by pointing me elsewhere if you can....
- Nic


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


--
Stefan Frank
iBioS - Intelligent BioInformatics Systems
http://www.dkfz-heidelberg.de/ibios
DKFZ - German Cancer Research Center
Im Neuenheimer Feld 580
69120 Heidelberg
Tel.: +49 (0) 6221 42-3612
Mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]






David Schwartz
Array Software Inc.
http://www.arrayone.com

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]





---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to