Michael Katz
asked on
Subreport with Multiple Variables
Hi Experts,
I have data that reads the following with Details of a SubReport...
LOC ST 03895
SO 0000000110295042
SO Moab
many more lines
I have created a formula within the subreport called @SalesOrderCommentLines
Shared StringVar CustomerNumber;
If {Documents/Document/Detail Data/Detai lLine/Comm ent.DetCom mentDescri pt}[1 to 30] LIKE "SO 000*" then
CustomerNumber:= {Documents/Document/Detail Data/Detai lLine/Comm ent.DetCom mentDescri pt}[4 to 30];
Shared StringVar CustomerOrderNumber;
If {Documents/Document/Detail Data/Detai lLine/Comm ent.DetCom mentDescri pt}[1 to 30] LIKE "LOC*" then
CustomerOrderNumber:= {Documents/Document/Detail Data/Detai lLine/Comm ent.DetCom mentDescri pt}[8 to 30];
Shared StringVar ShipToName;
If {Documents/Document/Detail Data/Detai lLine/Comm ent.DetCom mentDescri pt} [1 to 30] LIKE "*Mo*" then
ShipToName:={Documents/Doc ument/Deta ilData/Det ailLine/Co mment.DetC ommentDesc ript}[1 to 30];
I Placed this subreport in the ReportHeader of my Main Report..
I am trying to call each of these variable to the PageHeader a....
@SharedCustomer, @SharedCustomerOrderNumber , @ShipToName
I can grab the first 2 listed in this formula, but no matter what I try, the third does not come...@ShipToName
Hopefully this makes sense
I have data that reads the following with Details of a SubReport...
LOC ST 03895
SO 0000000110295042
SO Moab
many more lines
I have created a formula within the subreport called @SalesOrderCommentLines
Shared StringVar CustomerNumber;
If {Documents/Document/Detail
CustomerNumber:= {Documents/Document/Detail
Shared StringVar CustomerOrderNumber;
If {Documents/Document/Detail
CustomerOrderNumber:= {Documents/Document/Detail
Shared StringVar ShipToName;
If {Documents/Document/Detail
ShipToName:={Documents/Doc
I Placed this subreport in the ReportHeader of my Main Report..
I am trying to call each of these variable to the PageHeader a....
@SharedCustomer, @SharedCustomerOrderNumber
I can grab the first 2 listed in this formula, but no matter what I try, the third does not come...@ShipToName
Hopefully this makes sense
ASKER
Just trying to verify a record with Mo in it exists in the subreport data.
What is the formula to display that one?
mlmcc
What is the formula to display that one?
mlmcc
ASKER
The subreport variable is this
Shared StringVar ShipToName;
If {Documents/Document/Detail Data/Detai lLine/Comm ent.DetCom mentDescri pt} [1 to 30] LIKE "*Mo*" then
ShipToName:={Documents/Doc ument/Deta ilData/Det ailLine/Co mment.DetC ommentDesc ript}[1 to 30];
the formula to call into the Main Report is this
@SharedShipToName
WhilePrintingRecords;
Shared StringVar ShipToName:=ShipToName;
Shared StringVar ShipToName;
If {Documents/Document/Detail
ShipToName:={Documents/Doc
the formula to call into the Main Report is this
@SharedShipToName
WhilePrintingRecords;
Shared StringVar ShipToName:=ShipToName;
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
all 3 formulas are in the details of the subreport....they are not suppressed
Does the formula display correctly in the subreport?
mlmcc
mlmcc
ASKER
Not really sure how to answer that...The subreport has 20 Rows as Values within the Details...I have 1 formula that is at the Detail level of the Subreport...This 1 formula has 3 variables...the First 3 are set to show in the PageHeader a of the Main Report..but the First 2 only show..
The 3rd variable shows nothing...
The SubReport itself at the top of the Main Report shows the first Variable.
The 3rd variable shows nothing...
The SubReport itself at the top of the Main Report shows the first Variable.
Can you post that formula?
Copy it and paste it here
mlmcc
Copy it and paste it here
mlmcc
ASKER
Subreport Formula..for the portion related to the record showing in ReportHeader
and then showing in the PageHeader a
Shared StringVar CustomerOrderNumber;
If {Documents/Document/Detail Data/Detai lLine/Comm ent.DetCom mentDescri pt}[1 to 30] LIKE "LOC*" then
CustomerOrderNumber:= {Documents/Document/Detail Data/Detai lLine/Comm ent.DetCom mentDescri pt}[8 to 30];
-------------------------- ---------- ---------- ---------- -
MainReport Formula.. this is showing in the PageHeader a of the Main Report
@SharedShipToName
WhilePrintingRecords;
Shared StringVar ShipToName:=ShipToName;
and then showing in the PageHeader a
Shared StringVar CustomerOrderNumber;
If {Documents/Document/Detail
CustomerOrderNumber:= {Documents/Document/Detail
--------------------------
MainReport Formula.. this is showing in the PageHeader a of the Main Report
@SharedShipToName
WhilePrintingRecords;
Shared StringVar ShipToName:=ShipToName;
ASKER
Sorry this is the one that is showing ...
@SharedCustomerOrderNumber
WhilePrintingRecords;
Shared StringVar CustomerOrderNumber:=Custo merOrderNu mber;
this one is not showing
@SharedShipToName
WhilePrintingRecords;
Shared StringVar ShipToName:=ShipToName;
@SharedCustomerOrderNumber
WhilePrintingRecords;
Shared StringVar CustomerOrderNumber:=Custo
this one is not showing
@SharedShipToName
WhilePrintingRecords;
Shared StringVar ShipToName:=ShipToName;
DO you have 1 formula in the subreport that sets all the shared variables?
If so can you post the full formula?
There may be some reason that specific case isn't being handled correctly.
mlmcc
If so can you post the full formula?
There may be some reason that specific case isn't being handled correctly.
mlmcc
ASKER
i did..
@SharedSalesOrderCommentLi nes
Shared StringVar CustomerNumber;
If {Documents/Document/Detail Data/Detai lLine/Comm ent.DetCom mentDescri pt}[1 to 30] LIKE "SO 000*" then
CustomerNumber:= {Documents/Document/Detail Data/Detai lLine/Comm ent.DetCom mentDescri pt}[4 to 30];
Shared StringVar CustomerOrderNumber;
If {Documents/Document/Detail Data/Detai lLine/Comm ent.DetCom mentDescri pt}[1 to 30] LIKE "LOC*" then
CustomerOrderNumber:= {Documents/Document/Detail Data/Detai lLine/Comm ent.DetCom mentDescri pt}[8 to 30];
Shared StringVar ShipToName;
If {Documents/Document/Detail Data/Detai lLine/Comm ent.DetCom mentDescri pt} [1 to 30] LIKE "*Mo*" then
ShipToName:={Documents/Doc ument/Deta ilData/Det ailLine/Co mment.DetC ommentDesc ript}[1 to 30];
@SharedSalesOrderCommentLi
Shared StringVar CustomerNumber;
If {Documents/Document/Detail
CustomerNumber:= {Documents/Document/Detail
Shared StringVar CustomerOrderNumber;
If {Documents/Document/Detail
CustomerOrderNumber:= {Documents/Document/Detail
Shared StringVar ShipToName;
If {Documents/Document/Detail
ShipToName:={Documents/Doc
If that is a true cut and paste from the formula editor, I don't see any reason why it doesn't work.
DO you have a formula in the main report report header to declare the shared variables
WHilePrintingRecords;
Shared StringVar ShipToName;
Shared StringVar CustomerOrderNumber;
Shared StringVar CustomerNumber;
""
I would write the subreport formula differently. It shouldn't matter
Can you upload the report file?
I don't need any data in it. Maybe I'll see something then
mlmcc
DO you have a formula in the main report report header to declare the shared variables
WHilePrintingRecords;
Shared StringVar ShipToName;
Shared StringVar CustomerOrderNumber;
Shared StringVar CustomerNumber;
""
I would write the subreport formula differently. It shouldn't matter
WHilePrintingRecords;
Shared StringVar ShipToName;
Shared StringVar CustomerOrderNumber;
Shared StringVar CustomerNumber;
If Left({Documents/Document/DetailData/DetailLine/Comment.DetCommentDescript},6) = "SO 000" then
CustomerNumber:= {Documents/Document/DetailData/DetailLine/Comment.DetCommentDescript}[4 to 30]
Else If Left({Documents/Document/DetailData/DetailLine/Comment.DetCommentDescript},3) = "LOC"" THEN
CustomerOrderNumber:= {Documents/Document/DetailData/DetailLine/Comment.DetCommentDescript}[8 to 30]
Else If InStr({Documents/Document/DetailData/DetailLine/Comment.DetCommentDescript},"Mo") >0 THEN
ShipToName:={Documents/Document/DetailData/DetailLine/Comment.DetCommentDescript}[1 to 30];
Can you upload the report file?
I don't need any data in it. Maybe I'll see something then
mlmcc
ASKER
Here it is
staplespackingslip--3-.rpt
staplespackingslip--3-.rpt
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
I don't see anything particularly wrong with the formula either.
Why do you have the extra tables in the subreport?
You are only using data from one of them.
You might try deleting them from the report.
Crystal can do some strange things when it has extra tables particularly since they aren't linked together.
Also you might try setting the subreport so it can grow just to see what it produces. If you don't want it to show anything then the formula in it can be changed to end with "" which will display nothing each time. You can then also suppress blank sections ini the subreport and suppress a blank subreport.
mlmcc
Why do you have the extra tables in the subreport?
You are only using data from one of them.
You might try deleting them from the report.
Crystal can do some strange things when it has extra tables particularly since they aren't linked together.
Also you might try setting the subreport so it can grow just to see what it produces. If you don't want it to show anything then the formula in it can be changed to end with "" which will display nothing each time. You can then also suppress blank sections ini the subreport and suppress a blank subreport.
mlmcc
ASKER
James... Mlmcc,
nothing shows up...even the "test" that James presented...weird
nothing shows up...even the "test" that James presented...weird
You have the subreport in the report header.
Does anything show in the report header for the subreport?
If not, is the subreport allowed to grow?
mlmcc
Does anything show in the report header for the subreport?
If not, is the subreport allowed to grow?
mlmcc
I'm curious. Did you actually figure out what was wrong?
James
James
ASKER
It would appear that the subreport was not set to grow
Ah. mlmcc asked about that in his last post. If that was what prompted you to check, then that post probably should have been accepted as the solution.
IAC, thanks for letting us know.
James
IAC, thanks for letting us know.
James
Is the subreport visible?
If not can you make it visible?
Does it show the values you expect?
As best I can tell you are using the variables correctly.
The only thing I do differently is add WhilePrintigRecords; as the first line of each formula. It is not required but it serves to remind me when the formula is evaluated. Formulas with Shared variables are evaluated in the Printing Records pass.
mlmcc