Hello,

I designed a search page CustomerSearch and a result page CustomerSearchResult. The 
DataObject is doSomeQuery.
In the CustomerSearchResult page there is Date field which has the format of 
"dd/mm/yyyy", I did the formatting in 
date_onBeforeDisplayEvent(CSpDisplayEvent) using the following sentences:
    try {
         CSpDatetime datetime = getDisplayFieldValue("theDateField").datetimeValue();
         setDisplayFieldValue("thDateField", new 
CSpString(datetime.format("dd/mm/yyyy")));
    } catch (CSpDatetimeParsingException e) { }

With the above sentences, I got NullPointerException when conducting a search that 
does not hit the database. The reason
is since no rows returns the value of datetime will be null, then problem arises when 
calling datetime.format(). To fix it, in the
this_onAfterDataObjectExecuteEvent(CSpDataDrivenVisualEvent event) I redirect it to 
another page by calling 
somePage.load(). But this load will trigger onBeforeDisplayEvent, so still I got the 
NullPointerException.

Could anybody give me a solution?

Thanks in advance,
-Fujian
 
_________________________________________________________________________

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