Hi All,

This might be a simple question to many, but its bugging me a lot.
I have a table on the screen that has 2 repeated hrefs and 1 repeated checkbox.
The check box needs to be populated as a selected checkbox or an 
unselected checkbox (using manual code) based on the values from 
one of the repeated href fields. Please note that the hrefs are populated 
automatically by the execution of a dataObject. 

(Essentially, what i do is a string compare between the values that I have retrieved 
from another stored procedure and the values from one of the href fields. 
The repeated checkbox should be displayed on every row as a selected checkbox
for values that match.)
My problem here is that I cannot access each of the checkboxes 
in the row separately to set their selections.

I don't think I can use the 
myRepeated_onBeforeRowDisplayEvent, bcos I need to execute the stored procedure 
in the this_onBeforeRowDisplayEvent of the page,  And I need the results of this 
stored procedure at the same time for the string comparision with the results from 
the dataObject.

Non working Code follows
public int this_onBeforeDisplayEvent(CSpDisplayEvent event)
{
  int command = PROCEED;
  try
  {
   CSpProcedure stpStoredProc = (CSpProcedure) CSpider.getDataObject("stpStoredProc ");
   stpStoredProc .clearAllValues();

   // Populate stored procedure input parameters 
   ....param 1
   ....param 2
   
   // Execute stored procedure
   command = stpStoredProc.execute();           
   
   CSpValue storedProcOutput = stpStoredProc.getValue(0, "dtf_output_Parameter");
   // Please note that this is a string of values that can be separated later and
   // each value can be checked against the output from the dataObject 
                        
   CSpDataObject dataObject = (CSpDataObject) CSpider.getDataObject("dataObject");
   // Execute the dataObject
   dataObject.execute();

   if(dataObject.succeeded() && command != STOP)
   {
        int numOfRows = dataObject.getNumOfRows (); 
        for (int i = 0; i < numOfRows; i++) 
        { 
          CSpValue current =  dataObject.getValue (i, "dtf_output_Parameter_1"); 
          // Check if the current dataObject value matches with the output 
          // from the stored procedure
          if(current.toString() .equals(storedProcOutput))
          {
            CSpCheckBox chk1 = (CSpCheckBox) getDisplayField("*chk1"); 
            chk1.select(); 
            // DOES NOT WORK - it selects all the checkboxes from all the rows
          }
          else
          {
            CSpCheckBox chk1 = (CSpCheckBox) getDisplayField ("*chk1"); 
            chk1.unselect();  
          }
        }// end for loop 
    }// end if 
  }
   catch(Exception ex)
   {
        CSpLog.send(this, CSpLog.CRITICAL, "Caught in/after execution of stored proc / 
dataObject''");
   }
                        
 return (command);
}


Any suggestions , recommendations, modifications will be highly appreciated.

Thank you ,
Art.
[EMAIL PROTECTED]

_________________________________________________________________________

For help in using, subscribing, and unsubscribing to the discussion
forums, please go to: http://www.netdynamics.com/support/visitdevfor.html

For dire need help, email: [EMAIL PROTECTED]

Reply via email to