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

Suppress a text object in group Header based on record in detail 1

Status
Not open for further replies.

tsd30135

Technical User
Sep 21, 2004
38
US
Hello all

I need to turn suppress off on a text object based on the existence of a -1 in the nta field from the database. The logic needs to be such that if a -1 is found in any data record for field nta then the field is turned on (displayed) and to ignore any further values in the field.

Any ideas?

Thanks in advance

Tsd30135

 
Try posting technical information:

Crystal version
Database/connectivity used
Example data
Expected output

"to ignore any further values in the field"

Meaning that this field will have more than just a -1 in it, or that you don't want to display subsequent rows?

A little is lost in translation here.

You can create a formula to use for suppression, such as:

Group Header formula:
whileprintingrecords;
booleanvar SuppressMe:=False

Details section SuppressFormula
booleanvar SuppressMe;
if {table.nta} = -1 then
SuppressMe:=True;
SuppressMe

Your post topic sounds very different from what you've described within.

If it's group header related, then use something like:

Details section SuppressFormula
booleanvar SuppressMe;
if {table.nta} = -1 then
1
else
0

Now you can test in the group header for the existence of a -1 using:

sum({@SuppressMe},{table.group})>0

-k
 
Sorry for the incomplete title and message.

version 8.5
Sql server and access used. Vb gets a shaped recordset from DB.

Here is what I would like to do. In the past we have used 2 reports 1 to notify the customer of parking tickets outstanding and the second if there was a Notice to Appear. I want to combine these reports.

In the group header there is a text object stating there may be a Notice to Appear and this is based on any parking ticket record that has a NTA flag set. This flag is a -1
The report is set to suppress this text field by default, when reading in the data for the detail section if there is any record with a NTA flag set then unsuppress the text object continue to load the rest of the detail items.

I hope this helps some.

tsd30135

 
Here is some sample data and what I would like to see

Default report

Group Header

Text field1 = "Our records indicate that a vehicle"
Text field2 = "Failure to respond to this notice"
Text Field3 = "Our records indicate that a Notice to Appear" {suppressed by default}

Detail Section

ticket number NTA
12345 0
23456 0

Now the change
Group Header

Text field1 = "Our records indicate that a vehicle"
Text field2 = "Failure to respond to this notice"
Text Field3 = "Our records indicate that a Notice to Appear" {displayed}

Detail Section

ticket number NTA
12345 0
23456 -1
345678 0

If a -1 is in the field NTA on any record then I would field3 displayed.

I hope this helps.

tsd
 
My example seems applicable, did you try it?

Details section Check
if {table.nta} = -1 then
1
else
0

In the Suppress of the text field within the group header use:

sum({@SuppressMe},{table.group}) = 0

-k
 
I do not understand what the table.group field is. I tried to put the table.nta in its place but I got an error indicating could not create running total.
 
You said that you have a group header, which means that you're grouping on a field, use that field.

-k
 
I tried to use the grouping field in the sum field and this is the error I received.


The summary / running total could not be created
 
Well I sort of got it working. It appears that it is only evaluating the first record. Here is some sample data and some of the forumlas that I have used.

Group Header section
@InitializeSuppress
WhilePrintingRecords;

Numbervar SuppressMe1 :=0


Detail section
@GetSuppress
// Tried to create a running total. My thought was to
//try and create a running total if a -1 appears anywhere
// in the data then this would get incremented then use this value for the Suppress conditon.

WhilePrintingRecords;
Numbervar SuppressMe1;

if {adors_ttx.Ticket-NTA} = "-1" then

SuppressMe1 := SuppressMe1 +1
else
SuppressMe1 := SuppressMe1;

Text object in Group section
Suppress condition:

{@GetSuppress} =0


It keeps the suppression on the field if there is a 0 in the first detail record and it will unsuppress the field if there is a -1 in the data record. But I need to have it unsuppress if a -1 shows up in any record.

Thanks
TSD



 
For your suppression formula, try using:

sum({table.nta},{table.groupfield}) = 0

//where {table.nta} is your NTA field, and
//{table.groupfield} is your group field.

-LB
 
I keep getting the The summary / running total field could not be created.

tsd
 
What is your group field? It is probably something like an ID for a person. This is what belongs in the second part of the formula. Please provide the name of your group field and then also copy in the formula you are using for suppression.

-LB
 
Here is what the group section says

Group Header #1: adors_ttx.idcustomer -A

When I use the field adors_ttx.idcustomer in the second position I get an error.




Suppression formula

Sum ({@GetSuppress},{adors_ttx.idCustomer} )=0



@getsuppress formula Located in detail section

WhilePrintingRecords;
Numbervar SuppressMe1;

if {adors_ttx.Ticket-NTA} = "-1" then

SuppressMe1 := SuppressMe1 +1
else
0


 
You don't need to use a variable for this. Just use:

sum({adors_ttx.Ticket-NTA},{adors_ttx.idCustomer}) = 0

-LB
 
with this formula in the suppression field

sum({adors_ttx.Ticket-NTA},{adors_ttx.idCustomer}) = 0

I get "A number field or currency amount field is required here.

If I try this
sum(val({adors_ttx.Ticket-NTA}),{adors_ttx.idCustomer}) = 0

I get the can not create running total field

the field adors_ttx.ticket-nta is a 2 character string.

Does this help?
 
Sorry, I missed that this was a string. First create a formula {@nta}:

if {adors_ttx.ticket-nta} = "-1" then 1 else 0

Then use the following for your suppression formula:

sum({@nta},{adors_ttx.idCustomer}) = 0

-LB


 
That seemed to work. Can you tell me what I just did?

 
Thanks to all that helped me. With your help I was able to get a little ( I mean little) bit more understanding of how this is working.

If you want to take the time I would love to know what I did with the forula in the detail section.

Thanks again


Tsd
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top