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

Sub Report and Suppression

Status
Not open for further replies.

ricolame

IS-IT--Management
Nov 9, 2005
82
CN
Hi folks,

Been reading through the posts here for aiding but couldnt solve my issue.

I have 2 built-in subreports say Purchase Orders History and Sales orders History separately. I'm pulling shared variables from these two subreports in my Detail section where the 2 variables comprise of avg purchased unit price and avg sales unit price.

I would wish to hid the subreport details if a certain paramter is chosen in the main report say Hide=Yes.

I read that if i suppress the section, my shared variables from the subreports in my main report would not be correct.
Now if i chose not to suppress, but unclick the 'Can Grow', my shared variable is still not evaluated at all.

Any advises on what can be wrong? I'm stuck..
 
Shared variables from a subreport are only available in the section below the subreport. That's to do with the sequence in which Crystal does things and can't be changed.

From Crystal 9 onwards, it is possible to suppress a blank section where the subreport is blank. For 8.5 and below this was not possible; we had to do a work-round involving calling the subreport twice, the first time very small.

It always helps to post your Crystal version.

[yinyang] Madawc Williams (East Anglia, UK). Using Windows XP & Crystal 10 [yinyang]
 
Hi

Sorry version is Crystal 10.

I should redefine my question as :

Is there any way of 'hiding' my subreports yet viewing the shared variables that are drawn from my subreports?

I have suppressed blank subreport sections, and also, my shared variables are placed below where my subreports are positions (at footer)

 
You can make a subreport very small using the edit functions.

[yinyang] Madawc Williams (East Anglia, UK). Using Windows XP & Crystal 10 [yinyang]
 
Edit functions ?

Edit subreport? No clue on this..sorry.. tried unclicking 'Allow Growing'.. and yucks..my variables are not evaluated.

 
Suppress all sections within the subreport, format the subreport to "suppress blank subreport" and set the section expert to "suppress blank section". The shared variables will still work. Do not hide or suppress the section the subreport is in.

-LB
 
hi i'm doing all that. but the subreports are the 'details' of the main report.

I would wish to 'hide' the details through other means other than suppressing since i need to get the shared variable working.
 
I think you would have to add two subreports--one which you hide conditionally based on the parameter, and the other where you suppress all subreport sections, etc., as I suggested in my last post, which you use to pass the shared variables (sorry I didn't read your first post carefully the first time around).

-LB
 
Hi, if i have a paramter {?ShowDetail} and say user click on NO..

anyway of 'shrinking' the size away with the subreports so that itz almost removed from the other report that the user selects YES to {?ShowDetail}

My main report together with subreports have more than few hundred pages. But if i just show the main records in my main report it just just over 10 over pages...

Any opinion on this?
 
Please explain your overall report structure and where your two (or three?) subreports are located. Among other things, I wonder why you need the subreport at the detail section--this will really slow the report--and where you are trying to use the shared variable from the subreport(s). I couldn't follow your last post:

anyway of 'shrinking' the size away with the subreports so that itz almost removed from the other report that the user selects YES to {?ShowDetail}

Why do you need to shrink the size of a subreport? In the above suggestions you would either entirely suppress the subreport sections and suppress the blank section (for the subreport providing the shared variable values)or you would display or not display the section per the parameter.

-LB
 
Hi,

I guess i might have to explain from the purpose of the report i;m doing.

I am doing a main report pulling all my existing Part info in my inventory (Purchased or Manufactured or Both). Due to the many-to-many relationship, i need to have 3 subreports as follow:

1. Past 6mths or 12mths of buying price from purchase orders. (Obtain the avg buying price from this report)

2. Past 6mths or 12mths of selling price from cust orders
(And obtain the avg selling price from this report)

3. If there is no existing purchase, sales order history, i have to determine the last most updated default price maintained

Thus my subreports were placed in Da,Db and Dc of the Detail section. Also,i have tendencies of 2 subreports appearing too as a part can be purchased and sold too. And since my part unit price is dependent on all these 3 reports on runtime,all the avg prices obtain in my subreports were made shared variable and placed in my part group footer.


So comes my question on if i can suppress the subreports and yet evaluating and showing my results correctly. I have already done my most to 'shrink' my report by suppressing all unnecessary sections. And if e subreports are blank, i also had them suppressed too. All these were already done, as what you have said in the previous reply.

What I want is to hid away the list of order history if the user decides not to see it.Yet, my avg unit price(shared variable) for either of the subreports would still be evaluated, so that eventually i can determine the total part cost in my inventory..

I hope it gives a better picture.. i will stay tune to the posts. Thanks!
 
I think you could structure your report differently. Assuming you have a group on {table.partno}, then you could use the sales history table in the main report, place the info in the details section, and conditionally suppress the details section, based on a parameter. Since the table is still in the report, the most recent price will be available from this table, even in suppressed mode.

Then place the two subreports in separate group header sections_b and _c. Within each subreport, suppress all sections. Format each subreport to "suppress blank subreport" (format->subreport->subreport tab), and in the section expert, format GH_a and GH_b to "suppress blank section". This should cause the subreports to never show, while still allowing you to reference the shared variables in the group footer. You can then do your calculation in the group footer and if the subreport results are 0, you can use the sales history figure. You should have a reset formula for the shared variables in GH_a.

-LB
 
oh i got what you were saying. Why it wasnt done that way was i could have a part that has no sales history during the past 6 months, nor purchase history too. Likewise, i could even have no selling order history, but i could have a default price maintained in another table.

And yet my inventory would have stock. Those in my mind i had already picture a left outerjoin, where the parts in the warehouse are the main records before anything else come first..

LB could you elaborate more on this
Then place the two subreports in separate group header sections_b and _c. Within each subreport, suppress all sections. Format each subreport to "suppress blank subreport" (format->subreport->subreport tab), and in the section expert, format GH_a and GH_b to "suppress blank section". This should cause the subreports to never show, while still allowing you to reference the shared variables in the group footer
[\quote]

Esp the part you said about placing subreport in group header instead. Do you have in hand any report similar to such case that i can reference? If i'm using group header to show the main classification area, how does putting a subreport in a header becomes? It might be my visualisation problem..

Thanks!
 
Please try to be precise--I'm still a bit confused. Are there three possible sources of price PLUS a default table? I was talking about using the final default table in the main report, and subreports for the others.

Whether you have two or three, these belong in separate part number group header sections, after you have inserted a group on part number. After inserting the group, if you click on the gray area to the left of the report where it says GH#2 (assuming this is your second group), you can choose "insert section below". Do this twice so that you have GH2a,GH2b,and GH2c. Place the subreports in these sections.

-LB
 
Hi,

Okay, my report rough layout as below:

Input Parameter: Period of past 6 mths / past 12 mths

Grp Header #1: Part.type
Grp Header #2: Part.id
Detail a# Subreport 1:
Return shared variables avg_saleprice,count_no
Extract Sales Order History for stated period in main rpt
Detail b# Subreport 2:
Return shared variables avg_purprice,count_no
Extract Purchase Order History for stated period in main rpt

Detail c# subreport 3:
suppressed until bth subreports 1 2 return empty records.
Also returns a shared variable avg_part_default_price
Extract last default price maintained in system.This is also confusing to explain,but this table is also obtained by an subquery using Add Command consisting of an union of 2 subset of data from 2 selects from various tables:

I have a Customer part price table that keep track of the last updated default price (no date recorded)

Also I have a Vendor Quotation table that keep tracks of the quotations (inclusive of date)of parts to be purhased. This is the table that i use to track the default purchase price too if there is no purchase history present in the stated period of the main report.

Again, this report would have 2 default price values at most. Thus i wld perform an avg price to return.

---
Grp #2 Footer : Shared variables Avg_salesprice, avg_purprice, avg_def_price. Qty in inventory (part.qty),{evaluatePartTotalCost}

suppress shared variables returned that have no records in subreports. Logic to calculate total part cost depending on conditions as follow:

Code:
{evaluatePartTotalCost}
if {@salesFlag}=0 and {@purFlag}=0
    then {@Avg_DefPrice}*{part.qty}
else if {@salesFlag}=0 and {@purFlag}=1
    then {@Avg_purprice}*{part.qty}
else if {@salesFlag}=1 and {@purFlag}=0
    then {@avg_salesprice}*{part.qty}
else if {@salesFlag}=1 and {@purFlag}=1
    then ({@avg_salesprice}+{@avg_purprice})/2*{part.qty}

Subsequently i am using this to do subtotal records for my various part.type group

And lastly, my end report consist of the total cost amt. And as i have also highlighted in my other thread, without the use of suppression, my subtotals are spread across by over tens of pages. And my user main concern is to look at the subtotals before zooming in. I'm looking into placing all the subtotals at my end report by using a conditional summing logic .

Thus which explains why i was asking abt suppression of the subreports i have placed in my detail section.

Hope this would bring across a much better picture!







 
In reply to your post:

Are there three possible sources of price PLUS a default table? I was talking about using the final default table in the main report, and subreports for the others

From my abv explanation, yes to be precise there are 4 i'm looking at to determine the price i'm using for calculation
1. Past customer orders selling price avg
2. Past purchase orders purchased price avg
3. Default last updated part selling price
4. Default vendor quotes of part purchase price.
The last 2 were combined by me by additional sql query through add command. And extracted when subreport 3 is utilised.

I know abt adding various sections to a group. May i should phased it in another way. How does my subreport defers if i placed it in a group header than in detail ?

Mine will always return only a 'subreport' detail since my links are configured such that my retrival records are only based on this part.id supplied in my main report..


 
If there is only one detail record per part number, then it doesn't matter if you leave the subreports in the detail section. If there are multiple details, then your subreports are repeating unnecessarily, and you should move them to the group #2 header.

If you followed my earlier suggestions, and took those steps:

1-"suppress blank section" formatted for each detail section.
2-format subreport->suppress blank subreport

...then I think the subreports should not show when the subreports are empty.

If you conditionally want to suppress the subreport histories, then you need to add the subreports a second time in separate sections. In one instance, you would suppress all sections within the subreport (but not the section it is in), and format as above so the sections disappear, but the shared variables work. In the other, you would conditionally suppress the section the subreport is in.

-LB
 
Hi,

I am in the same situation so i followed the steps provided but still it does not do.
My situation is -

Env: CRXI

The Sub-Report is placed in the Detail Section which is D_c Section and i have few more detail sections above like D_a and D_b
So, If the Sub-Report does not have the records then the D_c section has to be moved above or Suppressed completely.

Also, i have the Summary data(using Formula) in the Detail Section which is D_d and just below D_c so that needs to be Suppressed whenever the Sub Report does not have the records to display.

Please your valuable hints which is urgent!!!

Thanks a lot,
Regards
 
Hi,

The first part worked with your tips ie.Suppress the Blank Report which is placed in the Detail_c Section.

But the trials did not work to Supresss the Summary Part which is placed in the Details_d Section.
So basically my concern is - When the Sub Report is blank then the Detail_d Section also has to be Suppressed.

Any help should be appreciated.

Thanks a lot,
Regards,

 
You haven't provided much information. Don't know what is in the subreport. Let's say that the subreport is supposed to return a summary value. In the subreport, create a formula:

whileprintingrecords;
shared numbervar x := sum({table.amt});

The formula should be based on a field that will populate whenever the subreport is not blank. Place this in the subreport report footer.

Then in the main report create a reset formula:

whileprintingrecords;
shared numbervar x := 0;

Place this in detail_b. Then go to the section expert->detail_d->suppress->x+2 and enter:

whileprintingrecords;
shared numbervar x;
x = 0 //note no colon

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top