Solved

using shared variable in crystal report 8.5

Posted on 2004-03-23
6
1,142 Views
Last Modified: 2007-12-19
I am trying to pass a boolean value from detail page to the Report header for checking a field in the detail section,i have wriiten the following code  in the detail section

//detail section Formula
whileprintingrecords;
shared booleanVar ispresent := false ;
if({Lines.cdeitem} = "B900") then ispresent = true
else ispresent = false;
and i wrote

//Header sectoin formula

whileprintingrecords;
shared booleanVar ispresent := false ;
if(ispresent = true) then "Y"
else "N"

when i am going to preview it is showing Broken link error
can any one suggest me ,what is solution for it ..or is there any other approac to do it.
I am calling this report from Vb6.0
0
Comment
Question by:tilu_padhi
  • 3
  • 2
6 Comments
 
LVL 100

Expert Comment

by:mlmcc
ID: 10662706
I am not sure of this but I believe SHARED variables are for passing informationbetween the main and subreports.  Try using GLOBAL instead of SHARED

mlmcc
0
 
LVL 13

Expert Comment

by:EwaldL
ID: 10662866
also, in the second formula change this line
global booleanVar ispresent := false ;
to global booleanVar ispresent;

otherwise you will always overwrite the value from the main report

most likely the broken link error has nothing to do with this though. do you get the same error having removed these formulas or are you also using these formulas for linking the main and subreport?
0
 

Author Comment

by:tilu_padhi
ID: 10662881
Thanks But it is not working ...can you please give me some sample code you have,for how to use this global..
0
Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

 
LVL 100

Accepted Solution

by:
mlmcc earned 25 total points
ID: 10664313
//detail section Formula
whileprintingrecords;
GLOBAL booleanVar ispresent;
if({Lines.cdeitem} = "B900") then ispresent := true
else ispresent := false;

//Header section formula
whileprintingrecords;
GLOBAL booleanVar ispresent ;
if(ispresent = true) then "Y"
else "N"

Does the detail section have multiple records?  If so I think you may need to try it this way
//Report header
GLOBAL booleanVar ispresent := FALSE;

//detail section Formula
whileprintingrecords;
GLOBAL booleanVar ispresent;
if({Lines.cdeitem} = "B900") then ispresent := true;

//Header section formula
whileprintingrecords;
GLOBAL booleanVar ispresent ;
if(ispresent = true) then
  ispresent := false;
  "Y"
else
  ispresent := false;
  "N"

mlmcc


0
 

Author Comment

by:tilu_padhi
ID: 11324939
Thanks
it worked..
0
 
LVL 100

Expert Comment

by:mlmcc
ID: 11331181
Glad I could help

mlmcc
0

Featured Post

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

I hate sub reports and always consider them the last resort in any reporting solution.  The negative effect on performance and maintainability is just not worth the easy ride they give the report writer.  Nine times out of ten reporting requirements…
There have always been a lot of questions related to when Crystal Reports evaluates report components (such as formulas, summaries, cross-tabs, charts, to name a few examples). Crystal Reports uses a two-pass reporting process to provide greater …
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now