Also look at http://asktom.oracle.com/pls/ask/f?p=4950:61:6135004253755051307::::P61_ID:2 64715428643
David Schwartz -----Original Message----- From: Keith [mailto:[EMAIL PROTECTED] Sent: Thursday, April 15, 2004 4:09 PM To: Tag Libraries Users List Subject: RE: Conditional Loop Hmm... I think I get what you did now. Didn't click before. I'll try it out tomorrow. Thanks! :) ---------- Original Message ----------- From: David Schwartz <[EMAIL PROTECTED]> To: "'Tag Libraries Users List'" <[EMAIL PROTECTED]> Sent: Thu, 15 Apr 2004 16:11:09 -0400 Subject: RE: Conditional Loop > The query I sent will do exactly that! > The sub-select with Count(Name) gives you the total number of product names > - that will correspond to your RowSpan amount. > > Since you want to display the Tech Type & Requirements beneath/within a > given Product name just add an Order By clause to the sql... > > Order By t.Product_Name, t.Technology_Type etc. > > Now your result set has everything you need - the JSTL need only display it. > > As for performance, with Oracle 9i the query should have sub-second > processing time (you can also tune it once you get your desired result set > working). > If you find that it's too slow make sure you have an index on Product_Name. > > David Schwartz > > -----Original Message----- > From: Keith [mailto:[EMAIL PROTECTED] > Sent: Thursday, April 15, 2004 3:25 PM > To: Tag Libraries Users List > Subject: RE: Conditional Loop > > Yes, it already is a lot of coding, so any working shortcut I can find is > good. ;) But, > some of the different columns in the DB are being combined into one column > in the > resulting HTML table (ex. a complete address), so the output is more compact > in the end. > It's an Oracle 9i R2 database. > > Here's a hopefully clearer explination of what I'm trying to do... > > Some of the DB information is product names, technology types, and > requirements with each > of those 3 being stored in their own table (they get joined). Some products > have multiple > technology types and requirements. Right now I have a <c:forEach> loop > outputting each > row. When a product name has multiple technology types or requirements, it > puts them in > their own, individual table row. So the same product name is being output in > multiple > rows, but each row having a different technology or requirement. > > To avoid the multiple product name listings, I was trying to create rowspans > based on how > many technologies or requirements a product had. So, the rowspan would be > changing with > each iteration through the loop. I was thinking that if I had a conditional > loop inside > the <c:forEach> loop (before the row is output), checking to see how many > technologies or > requirements there were for the current product name in the loop, I could > use that as a > variable for the rowspan. > > This is complex problem, I know. But it's what I'm stuck trying to figure > out. :p I admit > I could be thinking about this in completely the wrong way. I'm still a > novice > programmer, so if anyone understands what I'm trying to do and has a > different way to do > it, I'd appreciate it! > > Thanks! > > ---------- Original Message ----------- > From: David Schwartz <[EMAIL PROTECTED]> > To: "'Tag Libraries Users List'" <[EMAIL PROTECTED]> > Sent: Thu, 15 Apr 2004 15:07:20 -0400 > Subject: RE: Conditional Loop > > > >> Isn't there any way to do this via JSTL and not in the DB query? > > Maybe, but I'm not sure why you would want to. Seems like the > functionality > > you describe is a feature of the DB. > > Also, with JSTL & 30+ columns could be a lot of coding. > > > > Do you have more specific example? What db? > > > > David Schwartz > > > > -----Original Message----- > > From: Keith [mailto:[EMAIL PROTECTED] > > Sent: Thursday, April 15, 2004 2:28 PM > > To: Tag Libraries Users List > > Subject: RE: Conditional Loop > > > > Isn't there any way to do this via JSTL and not in the DB query? My > example > > was rather > > simplistic for what I'm really doing, but still is a good example of the > raw > > data. I'm > > using the resulting number in colspans and rowspans to build a nicer table > > layout > > (displaying data only once that's repeated for several rows). I was trying > > to avoid sub > > selects and such because I have anywhere from 30 and up columns that I'm > > returning and > > having to store a separate count variable for each one is getting > > ridiculous. I really do > > appreciate your time in replying, though! > > > > Keith > > > > ---------- Original Message ----------- > > From: David Schwartz <[EMAIL PROTECTED]> > > To: "'Tag Libraries Users List'" <[EMAIL PROTECTED]> > > Sent: Thu, 15 Apr 2004 14:23:03 -0400 > > Subject: RE: Conditional Loop > > > > > Try a sub select that returns the count... > > > > > > SELECT > > > > > > t.Primary_Key, > > > h.Name, > > > (Select Count(tt.Name) as Count_Name > > > FROM myTable tt > > > where tt.Name = t.Name > > > ) > > > FROM myTable tt > > > > > > It's fast & returns all nesc data from the db. > > > > > > David Schwartz > > > > > > -----Original Message----- > > > From: Keith [mailto:[EMAIL PROTECTED] > > > Sent: Thursday, April 15, 2004 1:45 PM > > > To: Taglibs > > > Subject: Conditional Loop > > > > > > Here's a generic scenario similar to my situation: > > > > > > A database with two columns, one being an auto-sequence number for the > > > primary key, the > > > other listing names. > > > > > > 1 Bob > > > 2 Bob > > > 3 Jim > > > 4 John > > > 5 Jim > > > 6 Bob > > > 7 John > > > 8 John > > > 9 Jim > > > 10 Bob > > > > > > Ok, I query the database to return both columns, since I need all the > > stored > > > data. But I > > > also want to get the number of each unique name in the 'names' column > (how > > > many Jim's, > > > how many Bob's, and how many John's). I know I could do a separate query > > > looking for a > > > count() on each unique name, but that's not realistic with the amount of > > > data I'm dealing > > > with (actually tried doing it and nearly killed the poor DB server). > > > > > > Normally, I'd do this with a 'while' conditional loop and a counter > > > incrementing while > > > the 'name' column contains a specific value, but I don't see that > > > functionality in JSTL. > > > I had asked generally before if JSTL had any 'while' loop capability, > but > > > got no > > > response. So, I figured I'd give an example of what I'm trying to do and > > > maybe someone > > > could help. > > > > > > Thanks! > > > > > > Keith > > > > > > --------------------------------------------------------------------- > > > 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] > > ------- End of Original Message ------- > > > > --------------------------------------------------------------------- > > 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] > ------- End of Original Message ------- > > --------------------------------------------------------------------- > 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] ------- End of Original Message ------- --------------------------------------------------------------------- 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]