Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2020 : Technical Questions
Message Icon Topic: A Number is required here - error message Post Reply Post New Topic
Author Message
sallyjenkins
Newbie
Newbie


Joined: 24 Jun 2014
Location: United States
Online Status: Offline
Posts: 6
Quote sallyjenkins Replybullet Topic: A Number is required here - error message
    Posted: 07 Jul 2014 at 11:14am

I am using Crystal Reports 11.5 and Crystal Reports syntax.  I am reading from a SQL DB

 

Here are the SQL Field types.

{AckParagraphs.AckParagraphBlurb} is a VarChar(Max)

{AckParagraphs.AckParagraphNum} is a nchar(5)

 

ParaNum is a Global NumberVar set to 999 in the group header.

 

The purpose of this formula is to print each detail line until a blank field is reached.  When the record with the blank field is read I want the variable set to the paragraph number.  This variable will be used in other formulas when printing records.

This formula is throwing and error on the 2nd 'If' "A number is required here.

If isNull({AckParagraphs.AckParagraphBlurb}) THEN

    ParaNum := ToNumber({AckParagraphs.AckParagraphNum}) 

Else If ParaNum = 999 THEN

    {AckParagraphs.AckParagraphBlurb}


I'm at a total loss. 

SAJ
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 07 Jul 2014 at 12:04pm

all possible results from a formula must return the sama data type

You don't have to display your formula field to use it in another formula
IP IP Logged
sallyjenkins
Newbie
Newbie


Joined: 24 Jun 2014
Location: United States
Online Status: Offline
Posts: 6
Quote sallyjenkins Replybullet Posted: 07 Jul 2014 at 12:12pm
If I understand correctly, this is blowing up because I am displaying the
{AckParagraphs.AckParagraphBlurb} - correct?

If that is so, then perhaps I should not set ParaNum
to a Numbervar.  The ParaNum is then set to {AckParagraphs.AckParagraphNum} (a string value, not changed to a number value).

am I getting warm?
SAJ
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 08 Jul 2014 at 3:52am
yes. they both need to be a string or numeric and clearly the numeric won't work for the blurb.
However, not knowing what your end game is here i cant really tell you how I would approach it.
 
This will give you the paragraph number for anything where the the blurb is null and a 999 for the non NULL rows... 
if isNull({AckParagraphs.AckParagraphBlurb}) THEN 999 ELSE ToNumber({AckParagraphs.AckParagraphNum}) 
 
However, I am concerned that you are trying to do some sort of linking on the reult of this formula. All your row level data has already been set via the table links by the time this formula is executed.


Edited by DBlank - 08 Jul 2014 at 3:53am
IP IP Logged
sallyjenkins
Newbie
Newbie


Joined: 24 Jun 2014
Location: United States
Online Status: Offline
Posts: 6
Quote sallyjenkins Replybullet Posted: 08 Jul 2014 at 4:35am
Many thanks for elaborating.  I am not going to be linking on ParaNum, but will be evaluating later.
I will give this a go later today.
SAJ
IP IP Logged
Post Reply Post New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum



This page was generated in 0.031 seconds.