Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Suppress multiple detail lines (no group) Post Reply Post New Topic
Page  of 2 Next >>
Author Message
SteveDLC
Newbie
Newbie
Avatar

Joined: 27 Jan 2016
Location: Australia
Online Status: Offline
Posts: 21
Quote SteveDLC Replybullet Topic: Suppress multiple detail lines (no group)
    Posted: 03 Apr 2016 at 7:31pm
Hi,

I have a CRXI report with 4 detail lines. Most of the information is related to a product code which appears on detail line A as the first field. All the other information is formula and sub-report based on the product code.

I'm trying to suppress all 4 detail lines 'if' one particular field or formula (in that group of 4 lines) is zero. I've read a lot of material and tried many things and even though I can actually get it to suppress, it either suppresses everything or nothing. I can't get it to suppress just the 4 lines I need.

I also tried creating groups to group them by product which seems a bit pointless since each group has just one product code with 4 detail lines but still had the same end result. I've tried using shared variables but still no luck.

It's possible the order in which the information is being executed could be my issue and would appreciate any help.

Thanks,
Steve.
IP IP Logged
Valert16
Groupie
Groupie
Avatar

Joined: 21 Mar 2016
Location: Spain
Online Status: Offline
Posts: 57
Quote Valert16 Replybullet Posted: 04 Apr 2016 at 1:05am
Not sure of understanding what your problem is. I use CR 2013, but I think that should work with version XI also. I proceed like this:
- Go to any detail section at the left of your report, on the blue colored area
- Right click the detail section --> Section Expert --> Click on details, not on details a, b, c, or d, just on details --> Click on the conditional formula icon for "Suppress (No Drill-Down) --> Type your conditions for suppressing the whole details section.

That should work...

Edited by Valert16 - 04 Apr 2016 at 7:07am
IP IP Logged
SteveDLC
Newbie
Newbie
Avatar

Joined: 27 Jan 2016
Location: Australia
Online Status: Offline
Posts: 21
Quote SteveDLC Replybullet Posted: 04 Apr 2016 at 1:39pm
Thanks Valert16 but I did that and it suppresses everything (not just the 4 sections applicable).

Formula as simple as {@val_01_Total} = 0
IP IP Logged
Valert16
Groupie
Groupie
Avatar

Joined: 21 Mar 2016
Location: Spain
Online Status: Offline
Posts: 57
Quote Valert16 Replybullet Posted: 04 Apr 2016 at 11:25pm
Cannot see where is the problem. When you say "it supresses everything" which sections are supressed? All details section for every row?, group header section?, other?

I've been doing some testing with a CR 10 version and it works fine, so I suppose there is some detail missing in your question.

The code "formula {@val_01_Total} = 0" will have the details section get supressed when {@val_01_Total} = 0. The only thing that can force all details section getting supressed in all rows is that the formula @val_01_Total returns zero in all cases. Have you verified that?

If nothing of above applies, could you post a screenshot of your report showing the section expert with "Details" selected, and the Formula Workshop with the code you are using?
IP IP Logged
SteveDLC
Newbie
Newbie
Avatar

Joined: 27 Jan 2016
Location: Australia
Online Status: Offline
Posts: 21
Quote SteveDLC Replybullet Posted: 05 Apr 2016 at 3:33pm
Okay so as an example, the report would have information about 10 products all with 4 lines of detail each. 3 of the products have {@val_01_Total} greater than zero (say it's 24) and the remaining 7 are zero. So in theory if I add the formula {@val_01_Total} = 0 to the 'Suppress (No Drill-Down)' then only those 7 products should not appear on the report. My problem is that it suppresses all 10 products. I tried by putting the formula is each of the details and again in the detail only. I also temporarily created groups to get it to work which had mixed results.

The {@val_01_Total} appears in detail D.

I can only assume there's something wrong with the layout that I've done. I've used the above method on other reports which has worked no problem. Still, I need help.
IP IP Logged
Valert16
Groupie
Groupie
Avatar

Joined: 21 Mar 2016
Location: Spain
Online Status: Offline
Posts: 57
Quote Valert16 Replybullet Posted: 05 Apr 2016 at 11:59pm
Hi SteveDLC,

I don't see any explanation for your problem except there's something wrong in your report. I can't help you without seeing it. All testing I've done reproducing your problem gives me the expected results.

Have you tried using another formula, instead of @val_01_Total?

You yourself recognize that this technique does work in other reports, so there's some detail that is missing here.
The only thing I can recommend you is to rebuild and test your report step by step, wich can help you to find the cause of the problem.
IP IP Logged
SteveDLC
Newbie
Newbie
Avatar

Joined: 27 Jan 2016
Location: Australia
Online Status: Offline
Posts: 21
Quote SteveDLC Replybullet Posted: 10 Apr 2016 at 3:44pm
Hi Valert16,

Thank you for being patient.

The working report has no sub-reports. It has a group header, footer and one detail line. There is a formula field in the group footer that, when it is zero, the those 3 rows are suppressed. All sounds straight forward.

The report I'm having trouble with (and another one as well which I've tried the same thing on) has sub-reports. All the information flowing back-and-forth displays correctly and I'm able to perform calculations no problem so I'm under the impression some of the sub-reports or formula fields may be in the wrong place.

Steve.
IP IP Logged
Valert16
Groupie
Groupie
Avatar

Joined: 21 Mar 2016
Location: Spain
Online Status: Offline
Posts: 57
Quote Valert16 Replybullet Posted: 11 Apr 2016 at 1:34am
What you have posted lately makes me think that you are using shared variables to pass information between one or many of the subreports and the main report.
I deduce also that the formula {@val_01_Total} is using a shared variable. If you use this formula in a detail section, you must be aware that it will work only if you use it in a section below the one that contains the subreport that assigns a value to the shared variable.

If that's not the case, suppressing the details section (not details a, b, c, etc.) will not work because the shared variable still contains its default value (zero if it is numeric type) and the formula probably returns zero, so all your details appear always suppressed.

The solution could be:
- Place the subreport that contains the shared variable used in {@val_01_Total} in the group header. I am assuming that this subreport only performs calculations and assigns a value to the shared variable. This way you can hide all details lines using the "Suppress (No Drill-Down)" conditional formula for the "details" section.
- If the subreport contains information you need to show, you should use one subreport to assign a value to the shared variable in GH, and another one for showing information in a detail section.
- Put the rest of fields and formulas in the details sections.

Hope this works...
IP IP Logged
SteveDLC
Newbie
Newbie
Avatar

Joined: 27 Jan 2016
Location: Australia
Online Status: Offline
Posts: 21
Quote SteveDLC Replybullet Posted: 11 Apr 2016 at 7:58pm
Hi Valert16,

There's about 10 subreports and most of them are in detail-a. One of them is in detail-b. Everything else is calculated from those after their placement in the report.

I understand what you've mentioned above but was unsure of exact placement. I've read a lot of material about the issue and couldn't find anything concrete in regards to position-vs-processing aside from everything being executed from left to right and top to bottom.

Would it make sense to place all subreports in the group header and then all formula's are derived from those in the detail sections via shared variables?

Thanks,
Steve.
IP IP Logged
Valert16
Groupie
Groupie
Avatar

Joined: 21 Mar 2016
Location: Spain
Online Status: Offline
Posts: 57
Quote Valert16 Replybullet Posted: 12 Apr 2016 at 12:11am
Hi SteveDLC,

You're right when you say there's little information in regards to the order of processing and its relation to the placement of the different objects of a report (fields, formulas, subreports, etc.).

There's a place in CR help that may provide you a little understanding about that. It's the section "Report Processing Model". Have a look at this model (the "three pass model"). I know there's not a very clear explanation of every step, but you will see that some formulas, running totals and subreports, among other objects, are processed in pass 2, also known as WhilePrintingRecords pass. Think of this pass as a kind of sequential execution, in the sense of going from top to bottom. If you have some objects in the same section, you cannot guess which object will processed first.

This means that, in this case, the way of assure that one object (subreport, formula...) is processed before another, is to place it in an upper section. For example, any shared variable from a subreport placed in details b, becomes available to a formula placed in details c, d or e, but not to a formula in details a or b.

With all this in mind, when you have many subreports and you use them only to perform calculations that are stored in one or many shared variables, it's correct to place them in the group header and then the formulas with the shared variables in the detail sections.

Finally, you can hide a section with a subreport (or many) that only performs calculations and doesn't have any information you wish to show. Search in the net if you don't know how to do it.

Edited by Valert16 - 12 Apr 2016 at 12:33am
IP IP Logged
Page  of 2 Next >>
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.031 seconds.