Print Page | Close Window

suppress blank section of data field and the label

Printed From: Crystal Reports Book
Category: Crystal Reports 9 through 2020
Forum Name: Technical Questions
Forum Discription: Formulas, charting data, Crystal syntax, etc.
URL: http://www.crystalreportsbook.com/forum/forum_posts.asp?TID=5278
Printed Date: 02 May 2024 at 11:09pm


Topic: suppress blank section of data field and the label
Posted By: johnwsun
Subject: suppress blank section of data field and the label
Date Posted: 20 Jan 2009 at 6:30pm
Hi
 
At the runtime I wish to suppress blank section of data field together with its label/description when there is no data in data field, e.g.
 
source:      XXXXX (data field)
 
the source (label) and the data field are in one of the Detail sections. I want to suppress source too when there is nothing in [data field] and without a blankline. Normally I can suppress the [data field] via section expert when there is no data. However, with label in that section I cannot achieve this. Any advices would be appreicated.
 
I'm using CR XI
 



Replies:
Posted By: DBlank
Date Posted: 20 Jan 2009 at 9:19pm
In the section expert detail section conditionally suppress the line with a formula:
isnull(field)=true


Posted By: johnwsun
Date Posted: 20 Jan 2009 at 9:40pm
After putting that formula to conditinally suppress the line, the report still display text/label:
 
source:
 
PLease provide further help, thanks very much


Posted By: lockwelle
Date Posted: 21 Jan 2009 at 6:33am

text/labels don't have the ability to be suppressed...so I make a formula.  In this case the formula would be:

"Source: " + {datafield}
 
Then when you 'format the field' for the formula, on the common tab there is a line to suppress, click the x-2 button and enter the code to suppress ie isnull({datafield})
 
Hope this helps


Posted By: DBlank
Date Posted: 21 Jan 2009 at 6:56am
Lockwelle,
Shouldn't the entire row regardless of any other item types that are on it be suppressed if a the condition is met via the suppression formula? I am understanding John's situation to be that both the text item and the data item reside on the same detail row, hence they can both be suppressed by suppressing the detail row under the single condition. Am i missing somethng there?
John, do you now if your "blank" values are nulls or empty strings? If they have empty strings you can also try to add in your suppression of the detail row:
 
isnull({table.field})=true or {table.field}=""


Posted By: lockwelle
Date Posted: 21 Jan 2009 at 9:04am
DBlank,
OOPS, absolutely, you are suppressing the entire row so the label is gone as well.  Since it is still visible, would imply that the data is not NULL, but something else (probably blank).
 
From the description, I thought that the field had been suppressed and that the label remained...
 
Gotta read more carefully.


Posted By: johnwsun
Date Posted: 21 Jan 2009 at 3:03pm
thank you all,
The text/label "Source" is actually hard coded in the section using Insert -> Text object:
Source:
I cannot use "Source: " + {datafield} in a formula as Lockwelle advised as that if there is data displaying they won't line up with the lines above and below.
All the text/labels are hard-coded in their sections, and the data fields are left aligned.
Is there a better way?


Posted By: DBlank
Date Posted: 21 Jan 2009 at 3:10pm

Did you try to suppress the detail section (not the datafield itself) in the section expert using the formula

isnull({table.field}) or {table.field}=""
 
If that does not work can you tell us what type of datafield is that is coming up "blank"


Posted By: johnwsun
Date Posted: 21 Jan 2009 at 3:18pm
Hi DGlank,
isnull({table.field}) or {table.field}=""  doesn't work.
my data field is just string field.


Posted By: DBlank
Date Posted: 21 Jan 2009 at 4:12pm
Ok I am at a loss as to why that is not suppressing it. I don't want to insult you but you are replacing the {table.field} with the actual data source correct?
I just can't think why that won't suppess the line...
Lockwell, any ideas here? Maybe trimming the field?


Posted By: johnwsun
Date Posted: 21 Jan 2009 at 5:14pm
Yes, I did; Because there was an error of "field name unknow" when saving this formula to exactly as you gave me.
As far as I can understand this issue, if the datafield in this section is null, the blank line can be suppressed; however, there is a text/label there, and the report thinks, "oh, there is something there, I cannot suppres it"
any further help would be appreciated.
 
Thanks


Posted By: DBlank
Date Posted: 21 Jan 2009 at 7:05pm
OK I think I might know what is going on here. I think you are putting the formula in the "Suppress Blank Section" in the section expert correct? If so:
1. Put it in the "Suppress(No drill Down)" formula box area. I should have made that clear on the first post and I assumed that was where you were putting it. Sorry about that.
2. Make sure the check box next to the Suppress(No Drill Down) is NOT checked. If it is checked it will suppress all of your detail records not just the empty ones based on the formula you just put in.
3. Take any formula out of the Suppress Blank section, you can still check the box but it should not have any effect because as you state "oh, there is something there, I cannot suppres it".
 
What we are doing is not suppresses a blank section but suppressing the whole section per row based on a condition. It will still show your other detail rows because they do not meet the condition we are puttiing in the formula. By putting the formula in the right place you can have 100 things in the section and still suppress it based on nearly any condition you want.
As an FYI to help you in the future when reading these posts, almost always people will share code to help but include fake values in the code because we do not know what your table or field names are (like the isnull(table.field) ). When reading the posts you have to insert your own data fields to make them applicable to your database and reports.
I really hope this one works for you Thumbs%20Up


Posted By: johnwsun
Date Posted: 21 Jan 2009 at 9:57pm

Thanks very much, DBlank, it now works after putting in the "Suppress(No drill down" Also thanks for how to clearly submit a query to the forum.

CheersSmile



Posted By: desaish
Date Posted: 08 Jun 2010 at 3:55am
Thanks a many. Using formulas in section expert really suppresses rows with blank field values.



Print Page | Close Window