using shared variable in crystal report 8.5

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
tilu_padhiAsked:
Who is Participating?
 
mlmccConnect With a Mentor Commented:
//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
 
mlmccCommented:
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
 
EwaldLCommented:
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
Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
tilu_padhiAuthor Commented:
Thanks But it is not working ...can you please give me some sample code you have,for how to use this global..
0
 
tilu_padhiAuthor Commented:
Thanks
it worked..
0
 
mlmccCommented:
Glad I could help

mlmcc
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.