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/DetailData/DetailLine/Comment.DetCommentDescript}[1 to 30] LIKE  "SO 000*" then
CustomerNumber:= {Documents/Document/DetailData/DetailLine/Comment.DetCommentDescript}[4 to 30];



Shared StringVar CustomerOrderNumber;
If {Documents/Document/DetailData/DetailLine/Comment.DetCommentDescript}[1 to 30] LIKE  "LOC*" then
CustomerOrderNumber:= {Documents/Document/DetailData/DetailLine/Comment.DetCommentDescript}[8 to 30];



Shared StringVar ShipToName;
If {Documents/Document/DetailData/DetailLine/Comment.DetCommentDescript} [1 to 30] LIKE "*Mo*" then
ShipToName:={Documents/Document/DetailData/DetailLine/Comment.DetCommentDescript}[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
Michael KatzAsked:
Who is Participating?
 
mlmccConnect With a Mentor Commented:
There is no need for the assignment in the display formula.  It shouldn't hurt but you can use

WhilePrintingRecords;
Shared StringVar ShipToName;
ShipToName

I assume all 3 formulas are in the details of the subreport?
Are they suppressed?

mlmcc
0
 
mlmccCommented:
Are you sure there is data that meets the criteria?

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
0
 
Michael KatzAuthor Commented:
Actual Lines that I am trying to read from Subreport to MainReport

If it wasn't visible why would the other 2 variable show on the Main Report.. I have included a screen shot of the system where the lines exist.. Eventually all of these lines need to be shared from a SubReport to the Main Report
0
Cloud Class® Course: Microsoft Windows 7 Basic

This introductory course to Windows 7 environment will teach you about working with the Windows operating system. You will learn about basic functions including start menu; the desktop; managing files, folders, and libraries.

 
mlmccCommented:
Just trying to verify a record with Mo in it exists in the subreport data.

What is the formula to display that one?

mlmcc
0
 
Michael KatzAuthor Commented:
The subreport variable is this

Shared StringVar ShipToName;
If {Documents/Document/DetailData/DetailLine/Comment.DetCommentDescript} [1 to 30] LIKE "*Mo*" then
ShipToName:={Documents/Document/DetailData/DetailLine/Comment.DetCommentDescript}[1 to 30];

the formula to call into the Main Report is this

@SharedShipToName

WhilePrintingRecords;
Shared StringVar ShipToName:=ShipToName;
0
 
Michael KatzAuthor Commented:
all 3 formulas are in the details of the subreport....they are not suppressed
0
 
mlmccCommented:
Does the formula display correctly in the subreport?

mlmcc
0
 
Michael KatzAuthor Commented:
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.
0
 
mlmccCommented:
Can you post that formula?
Copy it and paste it here

mlmcc
0
 
Michael KatzAuthor Commented:
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/DetailData/DetailLine/Comment.DetCommentDescript}[1 to 30] LIKE  "LOC*" then
CustomerOrderNumber:= {Documents/Document/DetailData/DetailLine/Comment.DetCommentDescript}[8 to 30];



---------------------------------------------------------

MainReport Formula.. this is showing in the PageHeader a of the Main Report

@SharedShipToName

WhilePrintingRecords;
Shared StringVar ShipToName:=ShipToName;
0
 
Michael KatzAuthor Commented:
Sorry this is the one that is showing ...

@SharedCustomerOrderNumber

WhilePrintingRecords;
Shared StringVar CustomerOrderNumber:=CustomerOrderNumber;

this one is not showing

@SharedShipToName

WhilePrintingRecords;
Shared StringVar ShipToName:=ShipToName;
0
 
mlmccCommented:
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
0
 
Michael KatzAuthor Commented:
i did..

@SharedSalesOrderCommentLines


Shared StringVar CustomerNumber;
If {Documents/Document/DetailData/DetailLine/Comment.DetCommentDescript}[1 to 30] LIKE  "SO 000*" then
CustomerNumber:= {Documents/Document/DetailData/DetailLine/Comment.DetCommentDescript}[4 to 30];



Shared StringVar CustomerOrderNumber;
If {Documents/Document/DetailData/DetailLine/Comment.DetCommentDescript}[1 to 30] LIKE  "LOC*" then
CustomerOrderNumber:= {Documents/Document/DetailData/DetailLine/Comment.DetCommentDescript}[8 to 30];



Shared StringVar ShipToName;
If {Documents/Document/DetailData/DetailLine/Comment.DetCommentDescript} [1 to 30] LIKE "*Mo*" then
ShipToName:={Documents/Document/DetailData/DetailLine/Comment.DetCommentDescript}[1 to 30];
0
 
mlmccCommented:
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
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]; 

Open in new window


Can you upload the report file?
I don't need any data in it.  Maybe I'll see something then

mlmcc
0
 
Michael KatzAuthor Commented:
0
 
James0628Connect With a Mentor Commented:
FWIW, I looked at the report, and nothing obvious jumped out at me.

 Try changing the end of your subreport formula to:

If {Documents/Document/DetailData/DetailLine/Comment.DetCommentDescript} [1 to 30] LIKE "*Mo*" then
ShipToName:={Documents/Document/DetailData/DetailLine/Comment.DetCommentDescript}[1 to 30]
else
ShipToName:="test";

Open in new window


 If you see "test" in the main report, then you know that the variable is working, and the problem is something in your test, or in the data.

 James
0
 
mlmccCommented:
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
0
 
Michael KatzAuthor Commented:
James... Mlmcc,

nothing shows up...even the "test" that James presented...weird
0
 
mlmccCommented:
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
0
 
James0628Commented:
I'm curious.  Did you actually figure out what was wrong?

 James
0
 
Michael KatzAuthor Commented:
It would appear that the subreport was not set to grow
0
 
James0628Commented:
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
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.