Nikhil, tried to do what U suggested, but then for each entry in the Hashtable,
I would have a vector, and since there are over 100 records...I will end up with
over 100 vectors. I wasn't sure if that was efficient.

What I am really trying to do is loop through one resultset A and in it, loop
through another resultset B, and get the matching rows.  So I tried searching
through the resultset B by using the while(rsB.next()) and then finding the rows
that I need, but the problem I had, jrun would not accept rsB.beforeFirst(), so
I got data for the first row and not the rest of resultset A.

Finally, I created 4 vectors, that each stored one of the columns of the
resultset B, and if the column had a null value, I replaced it with '-'.  Then
searched through one of the vectors for the parameter and

Vector vProj = new Vector();
Vector vODS_TYPE = new Vector();
Vector vPrevious_ODS = new Vector();
Vector vODS_Phased_Out = new Vector();

   while (rsB.next()){
      vProj.addElement(rsB.getString("SUB_PROD_ID") == null?"-":rsB.getString
("SUB_PROD_ID"));
      vPrevious_ODS.addElement(rsB.getString("Previous_ODS_to_be_Phased_Out")
==null?"-":rsB.getString("Previous_ODS_to_be_Phased_Out"));
      vODS_TYPE.addElement(rsB.getString("ODS_TYPE") == null?"-":sB.getString
("ODS_TYPE"));
     vPrevious_ODS.addElement(rsB.getString("Previous_ODS_to_be_Phased_Out")
==null?"-":rsB.getString("Previous_ODS_to_be_Phased_Out"))   ;
     vODS_Phased_Out.addElement(rsB.getString("ODS_Phased_Out") ==null?"
-":rsB.getString("ODS_Phased_Out"));}

// I loop through the Resultset A, and populate a row of the table, then search
for the parameter in one of the vectors (vProj).
------------------
-------------------
//

     for(int x = 0; x < vProj.size(); x++){
          if((vProj.elementAt(x)).equals(Sub_Project_ID)){
               counto++;
                 %>
                     <td class="ReportTableCellLabel">
                       <%=vODS_TYPE.elementAt(x)%>
                    </td>
                 <td class="ReportTableCellLabel">
                   <%=vPrevious_ODS.elementAt(x)%>
                </td>
               <td class="ReportTableCellLabel">
                     <%=vODS_Phased_Out.elementAt(x)%>
                 </td>
               <%
          }
     }

I don't know if this is the best solution, but that's the only way I could get
it to work.  When I first learned about the QueryTable Object, I thought it
would include a method to search through the QueryTable obj.

Thanks,

Zeina




                                                                                       
                                     
                    Nikhil Silsarma                                                    
                                     
                    <Nikhil.Silsarma@digit        To:     Jrun-Talk 
<[EMAIL PROTECTED]>                           
                    alrum.com>                    cc:                                  
                                     
                                                  Subject:     RE: Searching Resultset 
                                     
                    02/26/2002 10:58 AM                                                
                                     
                    Please respond to                                                  
                                     
                    jrun-talk                                                          
                                     
                                                                                       
                                     
                                                                                       
                                     
                                                                                       
                                     
                                                                                       
                                     




Why don't you use Hashtable( key=parameter, value=another hashtable/or
Vector). In that case, based on the key it will return the data).

Nikhil R Silsarma
Developer
DigitalRUM UK Ltd.
Tel: 020 7604 2049



-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: 26 February 2002 15:20
To: JRun-Talk
Subject: Searching Resultset


Drew, Great book!  Went through it over the weekend!  Wish I got it 6 months
ago, when I started to develop in JSP!  Could have saved me lot of time!!

Anyway, my q for the day.  I need to be able to search a resultset.  The
parameter that I need to use to search, is not unique in the Resultset and I
need to be able to get all the entries with that key.

I thought of using hashatable, but since the key is not unique, it won't
work, I
thought of using vectors of arrays.   I looked into QueryTable and didn't
find
any methods to get by key.

Is there an easy way to search the resultset based on a value?

Thanks,

Zeina



______________________________________________________________________
Your ad could be here. Monies from ads go to support these lists and provide more 
resources for the community. http://www.fusionauthority.com/ads.cfm
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to