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!

Pass a Shared StringVar

Status
Not open for further replies.

BradCustom

IS-IT--Management
Oct 5, 2007
296
US
I'm working with a simple report that shows all shipments. I have it grouped by Shipment Date and Part Number. The Shipment Date group is for each month.
I'm trying to find all shipments for a list of part numbers and sub-total those seperately from all shipments. The list of part numbers is in an Excel Spreadsheet which I added to the report as a subreport and joined it to the main report based on the Part number field. The subreport works fine all the part numbers that match are displayed. I then tryed to pass the Part Number from the subreport to the main report as a Shared Stringvar. Unfortunately every record shows a value for the passed variable and the records that have a matching part number in the subreport; the passed variable is one record off.

Below are the Pass formulas:
Subreport
Code:
whileprintingrecords;
shared stringvar PartNo := {Sheet1_.Part Number}
Placed in the details of the subreport

Main Report
Code:
whileprintingrecords;
shared stringvar PartNo;
PartNo
Placed in a section below the subreport.

Supreport is in GF2b
Pass is in GF2c

Thanks for you help!
 
So you have linked the sub to the main report on Part No and placed the sub in the Part No group footer, correct?

I think the variable in the sub should be in the footer section. Then in the main report, you should also add reset formula to the GF2a (it can be suppressed):

whileprintingrecords;
shared stringvar PartNo := "";

This will prevent the variable from retaining the previous value when there is no matching value in the current record.

-LB
 
Thanks for your help!!

You're correct that the main and subreport are linked by Part Number and the subreport is in the GF for the Part Number Group. btw this is Crystal XI; I noticed I did tell you that is the first post.

I tried your suggestion and the reset works (I had the reset in the GH for Part Number) but the Pass is still one record off. Below is an example of the display.

GH1 Transaction Date: 1/2009 (this group shows transaction/month)
GH2 Part No: 1234
Details: Trans-Date ; Quantity ; Unit-Cost
GF1 : has a summary of the months shiping dollars (for all part numbers)
GF2a : Has a summary of Quantity and Dollars for the month for each Part Number (also the Reset)
GF2b : Has the Subreport (the listing of part numbers)
GF2c : Has the passed Stringvar from the subreport

What is happening is if Part Number 1234 is in the Subreport list the subreport shows the number but the pass doesn't. The Passed Part number 1234 is displayed on the next record which is a different number lets say it's 5678 and may not match any of the numbers in the subreport list.

The reset has stopped the variable from showing on the numbers that don't match the subreport except in the case discribed above. I'm going to keep working on it any help would be greatly appreciated!!
 
That really sounds like the main report formula is positioned BEFORE the sub. I notice you are showing GF1 ABOVE GF2. This is not how it works. GF1 would appear below GF2. Please verify the position of the sub in relation to the main report formula. Also please verify the position of the formula within the sub.

-LB
 
Sorry that's my mistake the order in Design mode is:

GF2
GF1

The pass is located in GF2c on the Main report and the subreport is in GF2b.

On the subreport the pass is in GF1 and there is only one group Part Number. There is only one field displayed in the details (part number) and there are no additional formulas or selection criteria.

I can't figure out why it's skipping to the next record; it doesn't make any sence.

Thanks for your help!!
 
I just tried deleting the subreport; re-creating it and re-adding it to the main report but I still get the same result.

Thanks for your help!!
 
Please put the pass formula in the subreport report footer and then report back.

-LB
 
The problem is solved!!

In the main report on GF2a I have the numbers for the month for each part number. I also had the part number in GF2a; once I took that field (part number) out of GF2a everything works fine. I'll have to figure another way to display the part number so that everything is in one line.

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

Part and Inventory Search

Sponsor

Back
Top