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

Crystal XI - Subreport Shared Variable

Status
Not open for further replies.

bluraz

MIS
Aug 18, 2005
32
US
I am working with Crystal XI.

I have a main report which pulls Shipment data. I have a subreport, which main purpose is to pull from the Receipt data the date/time of arrival. The subreport is linked by a keysequence field. (The subreport contains the Receipt date/time and the Keysequence field in the detail section of the subreport.) Originally, I had the subreport placed in the GH1 of the Main report. This was giving me the first Receipt date/time of arrival on all detail items in the Main report. I then placed the subreport in Detail-b, of the Main (Detail-a contains the row names), and this almost works. It is skipping the first detail line and placing the first Receipt date / time field on the second detail line, etc.??
Code:
Here is some sample data:
GH1 - Consignee:  16
Da  - Consignee  ReceiptD/T  ShipD/T    Bill#  TimeDiff
Db  - 16                     6/3 23:15  123      0.00
Db  - 16         6/1 4:17    6/3 23:15  345     37.00 //Receipt d/t should be with bill # 123
GF1 - Shipment Count = 2     Avg Process Time = 18.5

I should also note... The TimeDiff calculation comes from a previous thread question thread767-1347179. I have a @resetgroup formula in GH1 and a @accum formula in Db of the main report.

Any help would be greatly appreciated!
Code:
@resetgroup:

whileprintingrecords;
numbervar sumdiff;
numbervar cnt;
if not inrepeatedgroupheader then(
sumdiff := 0;
cnt := 0
);

Code:
@accum:

Whileprintingrecords;
numbervar diff;
If datediff ('d', {@MainYardDate},{WMTRANSACTIONHEADER.ACTUALRECEIVEDSHIPPEDDATETIME})> 6 or
dayofweek ({@MainYardDate}) > dayofweek ({WMTRANSACTIONHEADER.ACTUALRECEIVEDSHIPPEDDATETIME})then
diff:= datediff('s',{@MainYardDate},{WMTRANSACTIONHEADER.ACTUALRECEIVEDSHIPPEDDATETIME})/3600 - 30 else
diff:= datediff ('s', {@MainYardDate},{WMTRANSACTIONHEADER.ACTUALRECEIVEDSHIPPEDDATETIME})/3600;
numbervar sumdiff := sumdiff + diff;
numbervar cnt := cnt + 1;
 
Data returned by a subreport will not be available till the section below the section with the subreport. Have you allowed for that?

[yinyang] Madawc Williams (East Anglia, UK). Using Windows XP & Crystal 10 [yinyang]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top