Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Newbie Missing Fields Question 1

Status
Not open for further replies.

Lynus

Technical User
Apr 12, 2003
69
I am designing a report in Crystal Reports 8. So far so good except for one snag. When I preview the report any feilds in the database that dont have anything in them dont show up on the preview. But I want them to. All of my fields have borders around them. If the field in the database is empty I would like it to display just a empty box. Any Ideas? I turned on the "Convert NULL Field value to default" option on in the report options but that didnt help.

Any informatoin greatly appreciated.
Thanks.
 
Instead of the field, use a formula instead:

if isnull({table.field}) then " " else {table.field}

Make sure there is a space between the quotes. If the field is a number, then change the formula to:

if isnull({table.field}) then " " else totext({table.field},0,"")

This will return a result no matter what, and therefore the borders will appear.

-LB
 
Where do I put that formula. I am really new to Crystal Reports.

Thanks.
 
Go to Field explorer and right click on formula fields. Choose new, choose a name, choose "Use editor" and then put the formula in there. Then drag that formula field onto the report, and (after you've checked you're happy with it) get rid of the field you had there.
Hope this helps, I am now using 9 and can't really remember where everything was in 8, so if what I've just put makes no sense let me know!
 
Ok, I put the following formula in:

if isnull({CharacterInformation.AbilSTR}) then " " else totext({CharacterInformation.AbilSTR},0,"")

When I go to check it I get an error: "Too many arguments have been given to this function" and it sticks the cursor right after the "else" part of the statement. Any ideas???

Thanks
 
What are you trying to do with the totext function?
What happens when you try: if isnull({CharacterInformation.AbilSTR}) then " " else {CharacterInformation.AbilSTR}
 
I get the following:
"The result of the selection formula must be a boolean"

 
Just text in the database.

 
Just in case I have caused a problem, the formula should be:

if isnull({CharacterInformation.AbilSTR}) then " " else {CharacterInformation.AbilSTR}
(there's no intentional new line)
 
I think you are creating the formula in the wrong place--you should not be in the formula section of the selection expert. Go to the field explorer->formula->new and enter the formula there.

-LB
 
Alright, I found the right place to put the formula but it gives me the same errors. I changed it and put this in:

if isnull({CharacterInformation.AbilSTR}) then " " else {CharacterInformation.AbilSTR}


This gave me no errors but doesnt help my original problem which is when I preview it its not there. If the field in the database is empty it doesnt show up. If there in info in the field then it shows up. I am assuming its because there is not information in the field that it is not showing up and I really need it to be an empty box if there is no information in the field.

Thanks for the help so far :)
 
Hi, To test that is is, in fact , in the right place and is handling all the possibilities try this as your formula:
Code:
if (isnull({CharacterInformation.AbilSTR})or
    {CharacterInformation.AbilSTR}= "") then "_" else {CharacterInformation.AbilSTR}

This, when placed on your report in place of the actual database field, should show a _ when the data is empty.

If it works, remove the _ and just leave a space.
Also be sure the field is not set to 'suppress if blank'
[profile]
 
Great Answer. Worked like a charm. Thanks TurkBear. I gave you a well deserved star. Thanks again.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top