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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Suppress Field if another field is suppressed

Status
Not open for further replies.

mchoss

Programmer
Feb 11, 2002
87
GB
I need to suppress the 'label'(text field) of a database column field where that column field is suppressed if duplicate. The both fields are in the detail section.

However, if i attempt formulas for the suppression of the label such as isnull({field}), this is not successful as the actual database field for the row is not in fact null, it has just been suppressed as it is a duplicate of the row before it! The same goes for length < 1 etc etc.

How can i create a formula for my 'label' field suppression such that it is only displayed if my database field is not a duplicate?

Thanks in advance.
 
Unless you have one label per record, instead of one label per group, this question makes no sense to me.

Does you report look like this:
Label
Database Field
Database Field

or this:
Label
Database Field
Label
Database Field

Where is this label located? In the details section or a group header or what?

having gone through all that you should be able to write a supression formula using the next() function as follows:

Next({Field})={Field}

However I am afraid that this formula will evaluate based on the location of the label.

Does this help at all?
Software Training and Support for Macola, Crystal Reports and Goldmine
714-348-0964
dgilsdorf@mchsi.com
 
Both my label (text field) and my database field are in the detail section, i know you would ordinarily have all labels in the header section, however due to the necessary layout of my report, i require the label for this field to be in the detail section, alongside the database field:

header

row 1: label ... database field
row n: label ... database field

This is precisely why i only want the label present, if the database field is present, however, as i am suppressing the database field if duplicate, i only want my label to appear on the rows where the database field is present.

Hopefully now you see my predicament, as the suppression formula editor seems to consider the actual database field value for a given row, regardless of the fact that it is suppressed due to its own formula.

Any clearer?
 
Yes, much better.

From the design window, right click the label and select format text. On the common tab, there is a button labeled &quot;X-2&quot; to the right of the suppress checkbox. This is for conditional suppression. Click it and enter the following formula:

Not OnFirstRecord;
{DatabaseField}=Previous({DatabaseField})

This will suppress the label when the database field is duplicated. &quot;The Not OnFirstRecord;&quot; is ther because previous() will return an error on the first record. Let me know if you have any questions. Software Training and Support for Macola, Crystal Reports and Goldmine
714-348-0964
dgilsdorf@mchsi.com
 
Much Thanks dgillz.

That preety much seems to do the job bar a couple of issues:

1 - The 'Not OnFirstRecord;' does not appear to be working. The Formula Editor shows no errors, but the label field is still suppressed for the first record of each page, despite the fact that the database field is not.

2 - For some reason, when the database field for the previous record is null and the current record is not, the suppression formula for the label field seems to evaluate as true, despite the fact that in such a situation the previous record is clearly not the same as the current and therefore suppression should not occur.

Thanks in advance.
 
&quot;Not onFirstRecord;&quot; is for the first record of the entire report, which is why you are not getting the label on the first page. I never considered this, and frankly I just spent 20 minuted trying to get a workaround to this and so far I cannot make it work.

The second part of your problem should be handled by testing for nulls with the use of the IsNull() function.



Software Training and Support for Macola, Crystal Reports and Goldmine
714-348-0964
dgilsdorf@mchsi.com
 
one question about your report

header

row 1: label ... database field
row n: label ... database field

if the database field is a duplicate do you want the whole row suppressed or only the label and database field and leave the reset of the fields alone(if any)

You can suppress an entire row if you wish using the section expert conditional suppress and the criteria you currently use to suppress the databasefield

But if I only wanted the Label and database field suppressed then I would use the same formula that is used to suppress the database field in the suppression formula to suppress the label....otherwise you may suppress the label when you don't want to.

Jim Broadbent
 
How about creating a variable that concatenates the label and the field, and then creating a boolean variable that changes from TRUE to FALSE if the concatenated field is a duplicate of the previous occurrence of the field. Then suppress the line if the boolean is FALSE. Then you reset the boolean to TRUE for the next test of the concatenated field, and if it stays TRUE, you don't suppress, but if it changes to FALSE, you do.

Would this work?

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top