Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: How to pass value between main and sub report? Post Reply Post New Topic
Author Message
hiuyil
Newbie
Newbie


Joined: 29 May 2011
Location: Hong Kong
Online Status: Offline
Posts: 6
Quote hiuyil Replybullet Topic: How to pass value between main and sub report?
    Posted: 30 May 2011 at 12:12am
1st, I want to initiate a variable in main report like:
 
Shared numbervar CartonCount:=0;
 
Then, I wil pass the variable to sub-report and do the calaulation and pass back to main report (these actions will repeat several time because I put the sub-report in details part):
 
local stringvar a="";
Shared numbervar CartonCount;
 
if ( (CartonCount = 0) and count ({app_shipping_UnitLoadDetail.header_path}) > 1)
then (
a := "CARTON"+ Totext(CartonCount+1)
CartonCount := CartonCount + count ({app_shipping_UnitLoadDetail.header_path}) 
a := "-"+"CARTON"+count ({app_shipping_UnitLoadDetail.header_path})
}
 
However, there is an error message in the highlighted(in red colour) CartonCount indicated by cursor:
"The ) is missing"
 
Anyone can help me to fix it and tell me if it is correct or not for what I did.
 
What I want to do is that I want to hv an accumulated a result which proceed the calculation in sub-report and pass it back to main report. Then, the main report run the detail part, the variable will be passed from main report to sub-report again -> calculations -> pass back to main report. (these actions proceed several times)
 
 
Thanks * 10000
IP IP Logged
Keikoku
Senior Member
Senior Member


Joined: 01 Dec 2010
Online Status: Offline
Posts: 386
Quote Keikoku Replybullet Posted: 30 May 2011 at 2:48am
What's the } at the end?
IP IP Logged
hiuyil
Newbie
Newbie


Joined: 29 May 2011
Location: Hong Kong
Online Status: Offline
Posts: 6
Quote hiuyil Replybullet Posted: 30 May 2011 at 8:14am
Sorry. Wrong typing.
The error message: "The ) is missing" still occur when I corrected "}" to ")" at the end of the formula.
IP IP Logged
Keikoku
Senior Member
Senior Member


Joined: 01 Dec 2010
Online Status: Offline
Posts: 386
Quote Keikoku Replybullet Posted: 30 May 2011 at 8:25am
Make sure you have a semi-colon at the end of each assignment statement.

Though, that probably isn't the problem either.
IP IP Logged
Dewald
Groupie
Groupie
Avatar

Joined: 02 Jun 2011
Location: South Africa
Online Status: Offline
Posts: 47
Quote Dewald Replybullet Posted: 02 Jun 2011 at 5:25am
This should do the trick
 
if ( (CartonCount = 0) and  ({app_shipping_UnitLoadDetail.header_path}) > 1) then
 a := "CARTON"+ Totext(CartonCount+1);
 CartonCount := CartonCount +  ({app_shipping_UnitLoadDetail.header_path});
 a := "-"+"CARTON"+ ({app_shipping_UnitLoadDetail.header_path});
 

 
 
 
Dewald Botha
http://www.ITClarity.co.za
IP IP Logged
Post Reply Post New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum



This page was generated in 0.008 seconds.