2 factors I can think of might apply here:

1.  The CSpProject class is tricky.  It was created mostly for ND's 
purposes, and problems can arise when you use it for other purposes.
2.  data objects execute in the context of sessions.  I think that in 
'init' processing, before real sessions, there is a 'faux' session.  The 
data obj 'get num of rows' method is a convenience method that operates on 
the data object's last result set in the context of a session.  When you 
call it in a real session you will not get the results from init processing.

It appears that you are trying to preload a listbox from a data object 
execution before any sessions have happened.  I would suggest that in the 
page's onafterinit event, you execute the DO and load the listbox.

-- Curt Springer, Team ND

At 03:24 PM 1/10/00 -0800, Keith Knaide wrote:

>I have definded a variable at the project level as follows:
>
>               public class KeithTestProject extends spider.CSpProject
>               //]]SPIDER_CLASS END
>               {
>         protected static CSpCriteriaSQLObject genDObj;
>               .
>               .
>               .
>
>Then I execute a data object as follows:
>
>         public int this_onAfterInitEvent(CSpInitEvent event)
>         {
>                 // This event runs the data object to fills the State 
> Code picklist
>                 //CSpHtml.sendMessage("got here");
>                 genDObj = (CSpCriteriaSQLObject) 
> CSpider.getDataObject("doStates");
>                 genDObj.clearDynamicCriteria();
>                 genDObj.addDynamicCriterion( 
> "df_CED_STATE_CODE_COUNTRYCD_CODE",
> 
>CSpCriteriaSQLObject.EQUAL_TO_STR_OPERATOR,
> 
>new CSpString("US"));
>                 genDObj.execute();
>
>                 if (genDObj.succeeded())
>                 {
>                         CSpHtml.sendMessage("Execute OK " + 
> genDObj.getNumOfRows());
>                         rowcount = genDObj.getNumOfRows();
>                 }
>                 else
>                 {
>                         CSpHtml.sendMessage("Error Executing Data Object");
>                 }
>                 return (PROCEED);
>         }
>
>I know it successes, because I see the  message "Execute OK 164".
>However, in a page within the project, I attempt to reference the data 
>object as follows
>but receive a NullPointerException
>
>         public int cbStates_onBeforeDisplayEvent(CSpDisplayEvent event)
>         {
>                 CSpHtml.sendMessage("Rows= " + 
> KeithTestProject.genDObj.getNumOfRows());
>                 return (PROCEED);
>                             .
>                             .
>                             .
>         }
>
>Why is this not valid; why don't I see "Rows=164"????
>_________________________________________________________________________
>
>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]

_________________________________________________________________________

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