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!

Limit record selection by user input

Status
Not open for further replies.

BradCustom

IS-IT--Management
Oct 5, 2007
296
US
I have a pretty simple report in Crystal XI that joins data from an Excel spreadsheet and a SQL Database. There are only two groups
GH1 Schedules_Excel_Download_.Part Nbr
GH2 Schedules_Excel_Download_.PO Nbr

GH1b has two subreports Sub-On Hand Qty and Sub-ProdQty
GH1c has two passed variables @OnHandQtyPassed and @InProdQtyPassed

GH2 has one subreport: SalesOrderDetail

Details: Schedules_Excel_Download_.Open Sched Qty
Schedules_Excel_Download_.Need Date
Schedules_Excel_Download_.Status Code

GF1 has two formulas:
Sum of Schedules_Excel_Download_.Open Sched Qty
@TotalShort

Below are all of the formulas listed above.
@OnHandQtyPassed
Code:
whileprintingrecords;
shared numbervar OnHandQty;
OnHandQty

The pass from the subreport:
whileprintingrecords;
shared numbervar OnHandQty:={@TotalOnHandQty}

@TotalOnHandQty
if isnull (sum({Material_Location.On_Hand_Qty})) then 0 else
sum({Material_Location.On_Hand_Qty})

@InProdQtyPassed
Code:
whileprintingrecords;
shared numbervar InProdQty;
InProdQty

The pass from the subreport:
whileprintingrecords;
shared numbervar InProdQty:=({@InProdQty})

@InProdQty
if isnull ({Job.Make_Quantity}) then 0 else
(Sum ({Job.Make_Quantity}, {Job.Part_Number}) - Sum ({Job.FG_Transfer_Qty}, {Job.Part_Number})) - Sum ({Job.Act_Scrap_Quantity}, {Job.Part_Number})

GF1 formula:
@TotalShort
Code:
Sum ({'Schedules_Excel_Download_'.Open Sched Qty}, {'Schedules_Excel_Download_'.Part Nbr})-({@InProdQtyPassed}+{@OnHandQtyPassed})

What I'm trying to do is to allow the user to either see all records or to see only records where the result of @TotalShort is >=1

I hope there is enough information to explain what I am trying to achieve. If not please let me know and I'll post the additional information.

Thank you your the help!!
 
You just have to understand one principle--that the shared variables are only available in sections below the one in which the subreport is located. Therefore, you cannot suppress anything with a shared varialbe that occurs in a section above the one where the shared variable is referenced. If your intention is to suppress the entire group #1 based on this formula result, you would have to put the subs in a GH#1 section above the sections you want suppressed and pass all values that you want to actually appear in the report as shared variables to the lower visible sections.

-LB
 
What I'd like to do is to allow the user to select what the output of the report is going to be; like a parameter field. Unfortunately I can't (or haven't) used a parameter field on the result of a formula.

Unfortunately I can't move the SalesOrderDetail subreport from GH2 because for a given part number there are multiple sales orders. If I move the SalesOrderDetail subreport to GH1 above the Passed values then the output is incorrect.

I'm not really looking to suppress records but rather limit the record selection based on the value of @TotalShort.

Thanks for your help!
 
You will only be able to use suppression in this case. You only need to move the Group Header #1 sub (since this is the only one generating shared variables used in your total short formula) to a GH_a section. You can pass whatever fields you want to show in the main report via shared variables, and make the entire sub disappear by suppressing all sections within the sub, formatting the sub to "suppress blank subreport", removing the borders, and then formatting GH#1a to "suppress blank section". This will all variables to still pass, but the sub will not appear. You can then use the variables to suppress later GH#1, group #2 and detail sections as you wish.

-LB
 
I understand what you've described but it seems your suggestion is a permanent suppression and not a selectable suppression. Unless I missed something in your description.

The permanent suppression is straight forward but what I'd like to do is a selectable suppression where the user can choose to suppress all records where @TotalShort is =<0 or can choose not to suppress.

Hopefully I didn't misread your post.
 
Well, sure you can use a parameter with it. Create a parameter {?Suppress} with options Yes and No. Then use a suppression formula like:

{?Suppress} = "Yes" and
{@TotalShort} <= 0

Or you could add a second parameter for them to choose the amount short.

-LB
 
Sorry its taken me a while to get back to this report but your syggestion works great!!

Thanks for all of your help!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top