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

Can use Data from a subreport in a formula in my main report? 1

Status
Not open for further replies.

terenceb

Programmer
Jun 10, 2003
77
US
Hi All,

I am working Crystal 8.5 pulling data from SQL table on a Cashe database.

I am attempting to use data from a subreport to be used in a formula in my main report. Is this possible?
 
Use "Shared Variables" to transfer data between Subreport and Main report

Jim Broadbent

The quality of the answer is directly proportional to the quality of the problem statement!
 
I am having trouble passing the data with that variable. I am not getting a value.

My Sub report formula looks like this:

whileprintingrecords;
Shared stringvar Services;

if {@Terminated}="T" and not({tx_history_all.SERVICE_CODE} in ['10' to '14', '20' to '24', '30' to '32', '40', '41', '50', '51', '60', '61', '72', '102', '103', '110', '183', '210', '300', '420',
'470' to '472', '480' to '482', '490' to '492', '670', '701' to '705', '710', '715' to '721', '750', '780', '821', '7800', '9500', '99995' to '99997',
'A111' to 'A128', 'A211' to 'A216', 'A228', 'A501', 'A504', 'A800', 'AM111', 'AM112', 'AM115', 'AM117', 'AM118' to 'AM121', 'AM126', 'AM211',
'AM212', 'AM215', 'AM216', 'AR300', 'AR310', 'AR311', 'AR332', 'AR333', 'AR337', 'AR338', 'AR356' to 'AR358', 'AR368', 'AR369', 'AR800', 'ARM300',
'ARM310', 'ARM356' to 'ARM358', 'ARM364', 'B504', 'BF1' to 'BF16', 'C104', 'C105', 'C800', 'C901' to 'C924', 'D101', 'D301', 'D800', 'G100', 'G101', 'G800',
'H800', 'HC300', 'HC310', 'HC311', 'HC320', 'HC321', 'HM300', 'HM310', 'HM311', 'HM320', 'HM321', 'HM330', 'HM331', 'J501', 'K402', 'K800', 'P143',
'P190', 'P191', 'P198', 'P199', 'P243', 'P800', 'P999', 'PCS01', 'T800', 'X115', 'X305', 'X311' to 'X314', 'X800', 'YP010', 'YP660', 'Z100' to 'Z102',
'Z200', 'Z502' to 'Z504', 'Z663', 'Z700', 'Z800', 'Z801', 'Z803', 'Z900' to 'Z903', 'Z991' to 'Z999'])then Services:={tx_history_all.SERVICE_CODE}
else Services:="";

and my Main formula looks like this:

WhilePrintingRecords;
Shared stringvar Services;
Services

I am linking the two reports on the date parameter.
 
Your Main Formula is placed in a section after the section containing the subreport??? It should be... If it isn't place the Main formula in a new subsection following the one containing the subreport.

Also...I don't like this kind of construction in this formula

in ['10' to '14', '20' to '24', '30' to '32', ...

You mean in ['10','11','12','13','14','20','21','22','23','24','30','31','32',...

I don't think Crystal predicts the fillers properly when they are strings. So write them out in full...considering the size of the array that is not too much of a chore.

This array should be declared in the report header and used by the array variable name...it is easier to understand your formula then.

A formula cannot simply be a declared array so end the formula with " " like this

//@Init
WhilePrintingRecords;
StringVar Array x := [ "","","".....missing data.....,"",""];
"" ""; //this makes the formula legal

Jim Broadbent

The quality of the answer is directly proportional to the quality of the problem statement!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top