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

How do I suppress a grouping if more than 1 iteration.

Status
Not open for further replies.

sfunk

Technical User
Jan 22, 2002
107
US
Hello,

I have a need to suppress a grouping and the detail iterations that come after the grouping if it is not the first iteration of that grouping. I hope that came out OK.

More details. The last grouping before the details section will re-iterate under the grouping above it. I don't want that to happen. i.e., Group6, should have one (the first returned) Group7 and the Details that are under Group7. Under no case do I want another Group7/Detail set under the same Group6 grouping.

I have an Oracle relational DB under an Object Oriented program and it makes things difficult sometimes. This is the only way I can come up with to work around the issue.

Thanks for any suggestions. I will be online checking this often so if there are any questions. I will get back to you quickly.

Sincerely.
steve
 
When in the section expert, select the group or details section you want to format, check the suppress box and click the formula button to the right and enter the following:

not isnull(previous({fieldname})

The 'fieldname' is the field by which that section is grouped.

This should suppress the section, only allowing it to the first iteration. If I understood your problem correctly this should help you out.
 
Hello,

Thank you for your help. It looks like we are on the right track.

I do however get an error when I test the formula. "A field is required here." I will * where it places the cursor in the formula window.

Not IsNULL(*Previous({CR_TASKVIEW.JOBTASKTIME}))
 
Not PreviousIsNULL({CR_TASKVIEW.JOBTASKTIME})

This is what seems to work. But I need to qualify the requirement a little. This suppresses the group from that point in the report on.

here is a diagram of what i need it to look look like.

...
Group6
Group7
Details
Details
Group7 <<<<Suppressed
Details <<<<Suppressed
Details <<<<Suppressed
Group6
Group7
Details
Details
Group7 <<<<Suppressed
Details <<<<Suppressed
Details <<<<Suppressed

Thank you for your help.

steve

 
In Group6 Header place a (suppressed) formula @ResetSuppress:
Shared booleanVar bSuppress;
bSuppress := False;
bSuppress

In Group 7 Footer place a (suppressed) formula @SetSuppress
Shared booleanVar bSuppress;
bSuppress := True;
bSuppress

In the Section Expert for Group 7 Header and Details, place a conditional Suppress formula:
Shared booleanVar bSuppress;
bSuppress

This will suppress all repeated Group 7's until a new group 6 header resets the value of &quot;bSuppress&quot;
 
rogar or anyone that make a suggestion,

The Formula you suggested above works GREAT. My next challenge is to run a SUM function on a field that resides in GroupHeader7 - only on the iterations that are not suppressed.

I have tried this formula below. But I get the crystal error that the loop has run to many times. I have also tried and IF...Then statement. It turns the value of the returned field to 0.

Shared booleanVar bSuppress;
While bSuppress = True
Do ({CR_TASKVIEW.JOBTASKTIME} / 60)

I am online and watching this forum closely I can try out suggestions and get right back to the group.

Thanks,
steve
 
I have figured out how to Edit the Running Total &quot;Evaluate&quot; and set it to Use a Formula. But when I put

Shared booleanVar bSuppress;
If bSuppress = False Then True

It doesn't return the correct data because bSuppress still is False for the Detail Section so I get too much data.

I think if Someone can tell me how to set a statement to say &quot;When GroupHeader7 = True&quot; I will have the solution I need. I bolded the part that needs work below. I don't know how to identify a groupheader in a formula so I'm using GroupHeader7 as an example. It is Group Header 7 in my report that I am working with.

If bSuppress = False and GroupHeader7 = True Then True

Thanks for the help.
steve
 
Create a formula JobTaskTime as follows:
Shared booleanVar bSuppress;
if bSuppress then 0 else {CR_TASKVIEW.JOBTASKTIME}/60


Place this formula (suppressed) on the detail line
Subtotal this formula in the Group7 footer or the Group6 footer. Grand Total if you want the sum for all groups.

 
rogar,

I'm doing something wrong.

I've made the formula like you suggested but when I go to make a Running Total the formula doesn't show up in the list on the right.

What am I doing wrong?

Thank you
steve
 
With the formula, you don't need a Running Total. Just use Insert/Subtotal.
 
Rogar,

I&quot;m sorry I'm being so dense here. When I go Insert/Subtotal, I look in the top dropdown box and it doesn't list my formula. It seems not to think it's a number, is that possible. I see other fields there that I know are numbers in fact that's all that shows up is field that are numerical.

Any suggestions.

Thank you again for your help.
steve
 
OK, this is more complicated than I thought. It's probably the bSuppress variable that is keeping the formula from being available for totaling.

Let's define another variable and set it to 0 in Group6Header (if you want separate totals by group) or in the Report Header if you want a grand total

formula InitTotal:
shared numberVar nTaskTimeTotal := 0

Change the detail-line formula to:
Shared booleanVar bSuppress;
shared numberVar nTaskTimeTotal;
if not bSuppress then
nTaskTimeTotal := nTaskTimeTotal + {CR_TASKVIEW.JOBTASKTIME}/60;
nTaskTimeTotal


Put a 3rd formula in the footer where you want to show the totals:
shared numberVar nTaskTimeTotal
This formula is the only one you make visible.

Be sure you get all the semicolons as shown and use &quot;:=&quot; for assignment of variable values.

This is the 3-formula method of making manual running totals that we used to use before CR had a built-in Running Total field.

 
Rogar,

I have played with this for a while and can't seem to get it to work. I have verified that I have it exactly as you listed it. As well as I tried some differences. The formula in the footer returns 0 eventhough I know there are numbers to add. Could you look at this again to see if there is anything else I can try?

Thank you
steve
 
It seems to bringing values back now. But doesn't seem to be working correctly.

It seems to bring back only the last figure instead of adding them up if that helps narrow it down.
 
Try making the detail formula
Shared booleanVar bSuppress;
shared numberVar nTaskTimeTotal;
if bSuppress then
nTaskTimeTotal := nTaskTimeTotal
else
nTaskTimeTotal := nTaskTimeTotal + {CR_TASKVIEW.JOBTASKTIME}/60;
nTaskTimeTotal


 
Rogar,

Thank you for all your help.

The issue that I have now is as nTaskTimeTotal is adding values up as it goes if it crosses over to another page it drops the aggrigate from the previous page. I Have tried to keep the group from spanning a page but there are too many iterations to keep that from happening. Here is an illustration.

Page 1
nTaskTimeTotal = 2.00
nTaskTimeTotal = nTaskTimeTotal + 3.50
Page 2
nTaskTimeTotal = nTaskTimeTotal + 1.25
display nTaskTimeTotal
The total should be 6.75 but it is only returning 1.25


Thank you for all your help. This has been quite a challenge.

Steve
 
I'm going to guess that the group header containing the formula InitTotal is repeated on the new page. Modify this formula as follows:

shared numberVar nTaskTimeTotal;
If Not InRepeatedGroupHeader then nTaskTimeTotal := 0
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top