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!

Date Parameter in Subreport

Status
Not open for further replies.
Jun 12, 2009
123
GB
Hi All,

I have created a simple crystal report using BOXI Rel 2, my report has 2 parameters
an End Date and a Start Date. I have also inserted a simple subreport (in Page Header) where I
want to reference the inputted Enddate parameter.

So I created a formula in main report
whileprintingrecords:
shared datevar test : = {?enddate};

and then referrenced it in the subreport in a formula

whileprintingrecords;
shared datevar test;

But in the subreport my reference formula is coming through blank, both reports
are very basic....anyone any ideas?

Many Thanks
 
You would have to set up the shared variable in a RH_a section, and then reference it in the sub placed in RH_b. I guess the question is why you are doing this. What is the purpose of the subreport? If you want the subreport to use the same parameter, you can use the parameter as a subreport linking field.

-LB
 
Hi lbass,

brill I forgot...I will setup in the RHa...

Iam in early stages of a requirement..but the user wants to see the main report reflecting the current week/fornight/month and then also have the previous week/fornight/month's figure available ie. minus from the date parameters. Hence I thought get the previous week's figures from a subreport.

This report will grow....

Many Thanks
 
I think you should be linking on the parameter instead of using a shared variable, and then adjust the selection formula in the subreport accordingly, e.g.,

{table.date} <= {?pm-?enddate} - 7

-LB
 
Hi lbass,

I have started developing this report further, I have a main report which has
5 groups. The user has a start and end parameter. I have a subreport which is
identical of the main report apart from ({?end}-7) which I have configured via the
subreport links and select expert in the subreport.

The problem I have is embedding the subreport into the main report and extracting
the values from the subreport.

The sub-report formula is :

Whileprintingrecords;
shared numbervar enddate := {#cost};

Which I am bringing into the main report via formula

whileprintingrecords;
shared numbervar enddate;

In the subreport links I have referenced the group 1 and 2 and the end date
parameter only.

I tried everything I know, please can you advise what I am doing wrong or how to improve.

Many Thanks
 
Not enough information here. I can't even tell what the problem is. Identify your groups in the main report by the fields you are grouping on, indicate in what section the subreport is located, where the shared variable is located in the subreport, how the {#cost} running total is set up (and why is the variable named 'enddate' if it is really a number related to cost?) and in what section you are referencing the shared variable in the main report. And finally, state what the problem is.

-LB
 
Hi lbass,

sorry, I have a main report and subreport the only difference being the main looks at
a start and end date entered by users and the subreport applies a -7 days.

Both reports have 5 groups, in the main report I have setup up a running total to sum and
placed at group footer 4. The running total evaluates each record and never resets.

The problem is I can not bring in the subreport figures into the main report ie. the running
total in the subreport is placed currently in the group footer 4 aswell.

Currently only the last value from the subreport is being populated in the main report.

I have tried various ways and currently no joy, added a reset etc etc...

Please can you advise..

Many Thanks
 
You didn't respond to all questions. What fields are you grouping on? How is the running total set up? Where is the shared variable located in the subreport? Also, what result are you expecting it to show?

-LB
 
1, Store Code
2, Team
3,Currency
4, YOA
5, Ref


I have setup up a running total to sum and
placed at group footer 4. The running total evaluates each record and never resets

The shared variable in the subreport is placed at GFb.

I am have put in one store code via the parameters, which is allocated to two teams. I am expecting two different values at YOA GFa level to come from the subreport.
Currently only the last value from the subreport is coming through, its not resetting somewhere....

Please advise if more info required...

Many Thanks
 
GFa/GFb doesn't identify which group--do you mean GF4a and 4b?

If you expect one rt value per team, you should change the running total to reset on change of team.

-LB
 
Hi lbass,

soz, yep GF4a....

I have changed the rt in the both subreport and main to reset at team level, but still not joy.

Thanks
 
Please show some sample data and show what value you expect where. I'm having trouble visualizing this. Actually, if you are expecting a value per team, the shared variable should be shown in GF2, and the shared variable that captures the running total should be placed in GF2 in the subreport.

-LB
 
1, Store Code = London
2, Team = A and B
3,Currency = GBP
4, YOA = 2009
5, Ref = Various

These are the five groups in the main report, which are driven by parameters (Store code, Team and Transaction Date)

I have placed a running total at the detail level which sums field 'money' and placed this at GF4.

I have a subreport exactly the same apart from the Transaction Date, which is -7 days. I have applied the same condition to the rt and want this to appear in the main report in GF4.

Please can you advise how this can be done....

If more information required..please advise

Many Thanks...
 
Please SHOW what your data looks like at the detail level and group levels for the running total and money fields. I still don't know what you want to see for a result from the subreport. What should it summarize? Do you want the total per team for 2009? If so, put the running total in the team group footer in both main and sub, make the rts reset on change of team, and if there are multiple values for YOA, use a formula in the running totals to limit YOA to 2009.

-LB
 
Hi lbass,

soz for the late response....I have a data file ready, how do I attach a excel spread sheet to this.....

Many Thanks
 
lbass, if you copy below into excel the format will sort it self out....Thanks



Store Code Team Currency YOA Movement Ref Money Incremented of Money Date Transaction
5H C GBP 2003 1 100 100 01/01/2004
5H C GBP 2003 2 100 0 15/03/2004
5H C GBP 2003 3 200 100 16/05/2004
5H C GBP 2003 4 300 100 20/10/2004
5H T GBP 2004 5 200 200 01/01/2005
5H T GBP 2004 6 200 0 20/02/2005
5H T GBP 2004 7 300 100 30/10/2006
5H T GBP 2004 8 350 50 01/12/2007
5H T GBP 2004 9 500 150 10/05/2008
5H T GBP 2004 10 500 0 29/07/2008
 
If the sub is linked on the first two groups, then it should be placed in a team group section, e.g., GH#2a of GF#2a, and the shared variable should be referenced in a secion below that, ie. in a "b" section.

-LB
 
Hi lbass,

the sr rt sums at GF4 and resets at this group. The same as the main report rt.

Where do I place the sr and reset variable in the main report?

Parameter Team, will grow...e.g. more than 2 teams

The problem is the subreport values do not reset when Group 2 (Team) changes?

Because the sr rt values are at GF4, currently I am only getting back the
last value in my main report...so in essence the values are not changing when the team changes.

The sr to main report links = I have 3

Store Code = Parameter based
Team = Parameter based
YOA = field based

Many Thanks
 
You keep changing your story. Anyway, the sub should then be placed in Group Footer 4a, with the shared varible referenced in Group Footer 4b. A reset formula for the shared variable should be placed in Group Header 4, and should look something like this:

whileprintingrecords;
shared numbervar x;
if not inrepeatedgroupheader then
x := 0;

-LB
 
thanks lbass, but still not resetting....have tried this formula on the test data I provided?

Thanks for your help...

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top