Many thanks. Your logic is more appealing. I will change my code.
> -----Original Message-----
> From: Dirk Kraemer [SMTP:[EMAIL PROTECTED]]
> Sent: 29 November 2002 08:21
> To: J M Okomba; dbforms-interest mailing list
> Subject: Re: [dbforms] RE: <db:dbform> with empty filtered data
> throws NullPointerException
>
> J M Okomba wrote:
> >
> > I call rsv_info.getField("info_type") because I need to use the value
> > returned. It's not for display purposes.
> >
> > Since I call rsv_info.getField("info_type") in the <db:body> tag I
> thought
> > dbform should not execute the <db:body> tag if there are no records
> returned
> > (and hence resultsetVector is null) or if it must execute <db:body> for
> some
> > reasons then I expect to get a null value when I call
> > rsv_info.getField("info_type") instead of an exception.
> What about the allowNew attribute? Have you checked that? If that is set
> to true,
> the body will be executed once. You did not answer that.
>
> Current it is:
>
> - if rsv_info == null: there is no result row
> - if rsv_info != null and rsv_info.getField("ff") == null :
> there is a row and the value for column "ff" is null
>
> That makes it possible to handle both cases differently. This is what you
> can
> do:
>
> 1) set allownew="true", don't use scripting vars, use labels instead
> 2) set allownew="false", use scripting vars
> 3) set allownew="true", use scripting vars, but check for nulls yourself:
>
> <% String type = (rsv_info == null) ? null :
> rsv_info.getField("info_type"); %>
>
> Btw. there might be programs where people use current behaviour:
>
> <% if (rsv_info == null) { %>
> // do something in case of empty result set...
>
> <% } else { %>
> // do something in case of rows found
>
> <% } %>
>
> If we would change that, we would not introduce new functionality, but
> take
> away old one and break compatibility with old applications.
>
> Regards
>
> Dirk
-------------------------------------------------------
This SF.net email is sponsored by: Get the new Palm Tungsten T
handheld. Power & Color in a compact size!
http://ads.sourceforge.net/cgi-bin/redirect.pl?palm0002en
_______________________________________________
DbForms Mailing List
http://www.wap-force.net/dbforms