Report Design
 Crystal Reports Forum : Crystal Reports .NET 2003 : Report Design
Message Icon Topic: how to Suppress blank field? Post Reply Post New Topic
Author Message
ericooi1976
Newbie
Newbie


Joined: 27 Jun 2007
Online Status: Offline
Posts: 5
Quote ericooi1976 Replybullet Topic: how to Suppress blank field?
    Posted: 27 Jun 2007 at 5:08am
Dear all  master,
 
I trying to suppress a blank field, it just can't work. anyone can help.
Im using the crystal report in Visual Studio 2003.
 
here i give some example that i want:
 
Name                    Age                     telno
abc                       12                        1234567
def                                                    9999999
ghi                         25                        9876543
 
you can see the age for name "def" is empty.
FYI, each of the data is individual field.
How can i suppress it, so that the age 25 will move up to "def"?
 
 
Thanks a lot
Regards,
Eric
IP IP Logged
BrianBischof
Admin Group
Admin Group
Avatar

Joined: 09 Nov 2006
Online Status: Offline
Posts: 2458
Quote BrianBischof Replybullet Posted: 27 Jun 2007 at 8:59am
Go to the Section Expert dialog box and find the Suppress property on the right. Click on the Formula button and set a formula similar to
[table.Age] = "";

This will suppress the record when the age is blank.
You could also set the record selection formula so that it says [table.Age]<> "".
Please support the forum! Tell others by linking to it on your blog or website:<a href="http://www.crystalreportsbook.com/forum/">Crystal Reports Forum</a>
IP IP Logged
ericooi1976
Newbie
Newbie


Joined: 27 Jun 2007
Online Status: Offline
Posts: 5
Quote ericooi1976 Replybullet Posted: 27 Jun 2007 at 6:50pm
Thanks for prompt reply.
 
I tried that way, but seem it not work for my case, because the all the field is individual.
 
like
 
abc (field "name1")         11 (Age field "age1")
def (field "name2")          22 (Age field "age2")
ghi (field "name3")         11 (Age field "age3")
 
please help...Thanks
IP IP Logged
BrianBischof
Admin Group
Admin Group
Avatar

Joined: 09 Nov 2006
Online Status: Offline
Posts: 2458
Quote BrianBischof Replybullet Posted: 27 Jun 2007 at 8:29pm
Really? That's interesting. I thought that your original example was three rows of record with each row being one Detail that was repeated. Now it appears that this whole example is on detail section with NINE fields in it. Actually, now that I read your post again I see that you mentioned that (I missed it).

Ok, I threw this formula together and it seems to work pretty well. It isn't very efficient (unless you make the AllAges variable Global so it doesn't have to be recalculated each time), but it's not a big deal.

Create this formula for each time you want to display the age and change the final array subscript for each formula from 1 to 2 to 3 so that it displays each index once. Also, put the full age field name in the formula.
StringVar AllAges;
AllAges := IIF({Age1}<>"", {Age1}+",","") & IIF({Age2}<>"", {Age2}+",","") & IIF({Age3}<>"", {Age3}+",","") & ",,,";
Split(AllAges,",")[1];

Real quick, this formula builds a comma separated string of all the non-blank age fields. If a field is blank then it doesn't get added. AFterwards, the string is split into an array and you just display one element of the array.

This should work for you! 
Please support the forum! Tell others by linking to it on your blog or website:<a href="http://www.crystalreportsbook.com/forum/">Crystal Reports Forum</a>
IP IP Logged
ericooi1976
Newbie
Newbie


Joined: 27 Jun 2007
Online Status: Offline
Posts: 5
Quote ericooi1976 Replybullet Posted: 29 Jun 2007 at 4:23am

Thanks it's help a lot

IP IP Logged
BrianBischof
Admin Group
Admin Group
Avatar

Joined: 09 Nov 2006
Online Status: Offline
Posts: 2458
Quote BrianBischof Replybullet Posted: 29 Jun 2007 at 10:31am
Glad to! A link is always appreciated. 
Please support the forum! Tell others by linking to it on your blog or website:<a href="http://www.crystalreportsbook.com/forum/">Crystal Reports Forum</a>
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.033 seconds.