Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Trouble with a formula - easy Post Reply Post New Topic
Author Message
lentil
Newbie
Newbie
Avatar

Joined: 28 Feb 2010
Location: Australia
Online Status: Offline
Posts: 18
Quote lentil Replybullet Topic: Trouble with a formula - easy
     Posted: 09 May 2010 at 3:23pm
Greetings all,  (as Ive said before I am not very smart but I can lift Heavy things)

I am having trouble writing a forumla to help me group data out of an accsess database.  The formula is being written from a field that comes from a check box so there is only two values on or off (OR so I thought)
any ways my Formula looks like this

if {tbl_activity.Actcompleted}= -1 then "Complete" else
"Not Complete"

Indicating if the Check Box had been checked its complete otherwise its incomplete

I have grouped the fromula in my report and its coming out with with three answers!

  1. Blank
  2. Complete
  3. Not Complete
I am assuming that the blank has to do with null values but I can seem to account for the null I cant put in Null or Zero into the formula it keeps asking for a number Value!

Any Suggestions?

Regards

Leith




IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 09 May 2010 at 4:15pm
Change the toggle/pick list value in the Formula editor from 'Use Nulls' to 'Use default values for nulls'
IP IP Logged
lentil
Newbie
Newbie
Avatar

Joined: 28 Feb 2010
Location: Australia
Online Status: Offline
Posts: 18
Quote lentil Replybullet Posted: 09 May 2010 at 5:56pm
umm yeah what I did was

if isnull ({tbl_activity.Actcompleted}) then "Not Complete" else
if {tbl_activity.Actcompleted} = 0 then "Not Complete" else
if {tbl_activity.Actcompleted} = 1 then "Not Complete" else
"Complete"


will this work ok?

IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 10 May 2010 at 6:09am

if it covers all the data variables in your table then it seems logical although I am guessing it is a boolean field. If so it is easier to flip the toggle to "Use default values for nulls" and then just use:

if {tbl_activity.Actcompleted} then 'Completed' else "Not Complete"
 
however you know your data, I am just guessing based on normal uses.


Edited by DBlank - 10 May 2010 at 10:38am
IP IP Logged
lentil
Newbie
Newbie
Avatar

Joined: 28 Feb 2010
Location: Australia
Online Status: Offline
Posts: 18
Quote lentil Replybullet Posted: 10 May 2010 at 10:05am
Thanks DBLANK ill give that a go when I get a chance!

IP IP Logged
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