PC Review


Reply
Thread Tools Rate Thread

Crystal Reports formulas and Blank reports

 
 
G. Stoynev
Guest
Posts: n/a
 
      26th Jun 2008
I can't seem to be able to prevent a Crystal Reports formula to
evaluate an expression when the report contains no records to show.

Here's the formula (DateTransferred is a DateTime column):

If IsNull({MyReportDataSet.DateTransferred}) Then
" " //empty string
Else
If ({MyReportDataSet.DateTransferred} = CDate("1/1/1900")) Then
" " //also pring an empty string - 1/1/1900 means "no date was
selected"
Else
ToText({MyReportDataSet.DateTransferred}, "MM/dd/yyyy");



It looks that even if IsNull returns true, Crystal is still trying to
evaluate this line
If ({MyReportDataSet.DateTransferred} = CDate("1/1/1900")) Then
which is causing the error "A date is required here" to be displayed.

I tried changing Report Options -> Convert DBNull to Default, bub that
didn't help.

I'd appreciate any help/advice

Using Crystal that comes w/ VS 2005



 
Reply With Quote
 
 
 
 
Ignacio Machin ( .NET/ C# MVP )
Guest
Posts: n/a
 
      26th Jun 2008
On Jun 26, 12:18*pm, "G. Stoynev" <gstoy...@gmail.com> wrote:
> I can't seem to be able to prevent a Crystal Reports formula to
> evaluate an expression when the report contains no records to show.
>
> Here's the formula (DateTransferred is a DateTime column):
>
> If IsNull({MyReportDataSet.DateTransferred}) Then
> * *" " //empty string
> Else
> * *If ({MyReportDataSet.DateTransferred} = CDate("1/1/1900")) Then
> * * * " " //also pring an empty string - 1/1/1900 means "no date was
> selected"
> * *Else
> * * * ToText({MyReportDataSet.DateTransferred}, "MM/dd/yyyy");
>
> It looks that even if IsNull returns true, Crystal is still trying to
> evaluate this line
> If ({MyReportDataSet.DateTransferred} = CDate("1/1/1900")) Then
> which is causing the error "A date is required here" to be displayed.
>
> I tried changing Report Options -> Convert DBNull to Default, bub that
> didn't help.
>
> I'd appreciate any help/advice
>
> Using Crystal that comes w/ VS 2005


how do you know if isnull is returning true?
 
Reply With Quote
 
G. Stoynev
Guest
Posts: n/a
 
      26th Jun 2008
On Jun 26, 12:26*pm, "Ignacio Machin ( .NET/ C# MVP )"
<ignacio.mac...@gmail.com> wrote:
> On Jun 26, 12:18*pm, "G. Stoynev" <gstoy...@gmail.com> wrote:
>
>
>
>
>
> > I can't seem to be able to prevent a Crystal Reports formula to
> > evaluate an expression when the report contains no records to show.

>
> > Here's the formula (DateTransferred is a DateTime column):

>
> > If IsNull({MyReportDataSet.DateTransferred}) Then
> > * *" " //empty string
> > Else
> > * *If ({MyReportDataSet.DateTransferred} = CDate("1/1/1900")) Then
> > * * * " " //also pring an empty string - 1/1/1900 means "no date was
> > selected"
> > * *Else
> > * * * ToText({MyReportDataSet.DateTransferred}, "MM/dd/yyyy");

>
> > It looks that even if IsNull returns true, Crystal is still trying to
> > evaluate this line
> > If ({MyReportDataSet.DateTransferred} = CDate("1/1/1900")) Then
> > which is causing the error "A date is required here" to be displayed.

>
> > I tried changing Report Options -> Convert DBNull to Default, bub that
> > didn't help.

>
> > I'd appreciate any help/advice

>
> > Using Crystal that comes w/ VS 2005

>
> how do you know if isnull is returning true?- Hide quoted text -
>
> - Show quoted text -


if I modify the formula like that (eliminate the problematic
expression)I see "no data" printed:
If IsNull({MyReportDataSet.DateTransferred}) Then
"no data" //empty string
Else
"some data"
 
Reply With Quote
 
Mr. Arnold
Guest
Posts: n/a
 
      26th Jun 2008

"G. Stoynev" <(E-Mail Removed)> wrote in message
news:42db2a59-1ac9-4437-8dd1-(E-Mail Removed)...
>I can't seem to be able to prevent a Crystal Reports formula to
> evaluate an expression when the report contains no records to show.
>
> Here's the formula (DateTransferred is a DateTime column):
>
> If IsNull({MyReportDataSet.DateTransferred}) Then
> " " //empty string
> Else
> If ({MyReportDataSet.DateTransferred} = CDate("1/1/1900")) Then
> " " //also pring an empty string - 1/1/1900 means "no date was
> selected"
> Else
> ToText({MyReportDataSet.DateTransferred}, "MM/dd/yyyy");
>
>
>
> It looks that even if IsNull returns true, Crystal is still trying to
> evaluate this line
> If ({MyReportDataSet.DateTransferred} = CDate("1/1/1900")) Then
> which is causing the error "A date is required here" to be displayed.
>
> I tried changing Report Options -> Convert DBNull to Default, bub that
> didn't help.
>
> I'd appreciate any help/advice
>


It seems to me that you should short-circuit the IF statement if IsNull
(remove the ELSE off the ISNull) and just come out of the formula return a
null string, a separate if for the null check.

If it's not ISNull, then do the other part of the formula, fall through.


 
Reply With Quote
 
G.S.
Guest
Posts: n/a
 
      26th Jun 2008
On Jun 26, 1:14*pm, "Mr. Arnold" <MR. Arn...@Arnold.com> wrote:
> "G. Stoynev" <gstoy...@gmail.com> wrote in message
>
> news:42db2a59-1ac9-4437-8dd1-(E-Mail Removed)...
>
>
>
>
>
> >I can't seem to be able to prevent a Crystal Reports formula to
> > evaluate an expression when the report contains no records to show.

>
> > Here's the formula (DateTransferred is a DateTime column):

>
> > If IsNull({MyReportDataSet.DateTransferred}) Then
> > * " " //empty string
> > Else
> > * If ({MyReportDataSet.DateTransferred} = CDate("1/1/1900")) Then
> > * * *" " //also pring an empty string - 1/1/1900 means "no date was
> > selected"
> > * Else
> > * * *ToText({MyReportDataSet.DateTransferred}, "MM/dd/yyyy");

>
> > It looks that even if IsNull returns true, Crystal is still trying to
> > evaluate this line
> > If ({MyReportDataSet.DateTransferred} = CDate("1/1/1900")) Then
> > which is causing the error "A date is required here" to be displayed.

>
> > I tried changing Report Options -> Convert DBNull to Default, bub that
> > didn't help.

>
> > I'd appreciate any help/advice

>
> It seems to me that you should short-circuit the IF statement if IsNull
> (remove the ELSE off the ISNull) and just come out of the formula return a
> null string, a separate if for the null check.
>
> If it's not ISNull, then do the other part of the formula, fall through.-Hide quoted text -
>
> - Show quoted text -


You mean:
If (IsNull({MyReportDataSet.DateTransferred})) Then
"no data";

If (Not IsNull({MyReportDataSet.DateTransferred})) Then
(
If ({MyReportDataSet.DateTransferred} <> CDate("1/1/1900")) Then
"good data - date has been selected"
Else
"deliberately not selected";
)

??
Is there a way to force-exit from Crystal formula? Something like
"return;"?
 
Reply With Quote
 
Mr. Arnold
Guest
Posts: n/a
 
      26th Jun 2008

"G.S." <(E-Mail Removed)> wrote in message
news:8bad31f8-f937-426d-8e5c-(E-Mail Removed)...
On Jun 26, 1:14 pm, "Mr. Arnold" <MR. Arn...@Arnold.com> wrote:
> "G. Stoynev" <gstoy...@gmail.com> wrote in message
>
> news:42db2a59-1ac9-4437-8dd1-(E-Mail Removed)...
>
>
>
>
>
> >I can't seem to be able to prevent a Crystal Reports formula to
> > evaluate an expression when the report contains no records to show.

>
> > Here's the formula (DateTransferred is a DateTime column):

>
> > If IsNull({MyReportDataSet.DateTransferred}) Then
> > " " //empty string
> > Else
> > If ({MyReportDataSet.DateTransferred} = CDate("1/1/1900")) Then
> > " " //also pring an empty string - 1/1/1900 means "no date was
> > selected"
> > Else
> > ToText({MyReportDataSet.DateTransferred}, "MM/dd/yyyy");

>
> > It looks that even if IsNull returns true, Crystal is still trying to
> > evaluate this line
> > If ({MyReportDataSet.DateTransferred} = CDate("1/1/1900")) Then
> > which is causing the error "A date is required here" to be displayed.

>
> > I tried changing Report Options -> Convert DBNull to Default, bub that
> > didn't help.

>
> > I'd appreciate any help/advice

>
> It seems to me that you should short-circuit the IF statement if IsNull
> (remove the ELSE off the ISNull) and just come out of the formula return a
> null string, a separate if for the null check.
>
> If it's not ISNull, then do the other part of the formula, fall through.-
> Hide quoted text -
>
> - Show quoted text -


You mean:
If (IsNull({MyReportDataSet.DateTransferred})) Then
"no data";

If (Not IsNull({MyReportDataSet.DateTransferred})) Then
(
If ({MyReportDataSet.DateTransferred} <> CDate("1/1/1900")) Then
"good data - date has been selected"
Else
"deliberately not selected";
)

??
Is there a way to force-exit from Crystal formula? Something like
"return;"?


When you're in the language IDE for creating the formula is there *return*
there for the function you can choose? It's been many years since I last saw
Crystal.

That statement by itself will exit the formula if it's true and return "no
data", if I recall correctly.

If (IsNull({MyReportDataSet.DateTransferred})) Then
"no data";


I guess you got that email instead of this post, since I didn't get a not
delivered email.


 
Reply With Quote
 
G.S.
Guest
Posts: n/a
 
      26th Jun 2008
On Jun 26, 2:33*pm, "Mr. Arnold" <MR. Arn...@Arnold.com> wrote:
> "G.S." <gstoy...@gmail.com> wrote in message
>
> news:8bad31f8-f937-426d-8e5c-(E-Mail Removed)...
> On Jun 26, 1:14 pm, "Mr. Arnold" <MR. Arn...@Arnold.com> wrote:
>
>
>
>
>
> > "G. Stoynev" <gstoy...@gmail.com> wrote in message

>
> >news:42db2a59-1ac9-4437-8dd1-(E-Mail Removed)....

>
> > >I can't seem to be able to prevent a Crystal Reports formula to
> > > evaluate an expression when the report contains no records to show.

>
> > > Here's the formula (DateTransferred is a DateTime column):

>
> > > If IsNull({MyReportDataSet.DateTransferred}) Then
> > > " " //empty string
> > > Else
> > > If ({MyReportDataSet.DateTransferred} = CDate("1/1/1900")) Then
> > > " " //also pring an empty string - 1/1/1900 means "no date was
> > > selected"
> > > Else
> > > ToText({MyReportDataSet.DateTransferred}, "MM/dd/yyyy");

>
> > > It looks that even if IsNull returns true, Crystal is still trying to
> > > evaluate this line
> > > If ({MyReportDataSet.DateTransferred} = CDate("1/1/1900")) Then
> > > which is causing the error "A date is required here" to be displayed.

>
> > > I tried changing Report Options -> Convert DBNull to Default, bub that
> > > didn't help.

>
> > > I'd appreciate any help/advice

>
> > It seems to me that you should short-circuit the IF statement if IsNull
> > (remove the ELSE off the ISNull) and just come out of the formula return a
> > null string, a separate if for the null check.

>
> > If it's not ISNull, then do the other part of the formula, fall through..-
> > Hide quoted text -

>
> > - Show quoted text -

>
> You mean:
> If (IsNull({MyReportDataSet.DateTransferred})) Then
> * * "no data";
>
> If (Not IsNull({MyReportDataSet.DateTransferred})) Then
> (
> * * If ({MyReportDataSet.DateTransferred} <> CDate("1/1/1900")) Then
> * * * * "good data - date has been selected"
> * * Else
> * * * * "deliberately not selected";
> )
>
> ??
> Is there a way to force-exit from Crystal formula? Something like
> "return;"?
>
> When you're in the language IDE for creating the formula is there *return*
> there for the function you can choose? It's been many years since I last saw
> Crystal.
>
> That statement by itself will exit the formula if it's true and return "no
> data", if I recall correctly.
>
> If (IsNull({MyReportDataSet.DateTransferred})) Then
> * * "no data";
>
> I guess you got that email instead of this post, since I didn't get a not
> delivered email.- Hide quoted text -
>
> - Show quoted text -


Thank you for your help!
No, I didn't see a return statement in any of the canned functions/
operatorrs list in the IDE. The Crystal Reports help in VS2005 Help is
not helpful at all... I tried to guess a few times Exit, Return,
Stop... no avail.

I've used crystal enterprise in the past and have never encountered
that problem. This is typical Crystal stuff - not intuitive and hard
to debug/find help. Thanks again!
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Crystal Reports Does Not Display BLOB Field Correctly in IBlobField Control Using Crystal Reports for VS.NET 2003 Jeff Microsoft Dot NET 0 4th May 2006 09:21 PM
Calling Crystal Reports in ASP.NET using the rptserver.asp given by Crystal Reports Peri Microsoft ASP .NET 1 21st Jul 2005 01:56 PM
Calling Crystal Reports in ASP.NET using the rptserver.asp given by Crystal Reports Peri Microsoft VB .NET 1 21st Jul 2005 01:56 PM
Crystal Reports newbie question: binding single .NET WinForm to different reports files at runtime? Michael Microsoft Dot NET 0 23rd Apr 2004 07:56 PM
Crystal Reports newbie question: binding single .NET WinForm to different reports files at runtime? Michael Microsoft Dot NET Framework Forms 0 23rd Apr 2004 07:45 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 09:42 AM.