Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Boolean variable reset Post Reply Post New Topic
Author Message
nalfein
Groupie
Groupie


Joined: 07 Jul 2008
Online Status: Offline
Posts: 47
Quote nalfein Replybullet Topic: Boolean variable reset
    Posted: 13 Jun 2013 at 1:44am
Hi I've create a field with this code

WhilePrintingRecords;
Booleanvar flg_stampa_piede_s6:=false;

And put in the header

In the details I've a field that must be checked with this formula

WhilePrintingRecords;
if instr ({stdoc_righe.rig_parte},"S6")>0 then
BooleanVar flg_stampa_piede_s6:=true;
flg_stampa_piede_s6

So if in the field there's "S6" word the variable change to true.
And it works fine. I've put the field in the details and the true appear.

In the report footer I've another field with suppress code in this way

BooleanVar flg_stampa_piede_s6;
if flg_stampa_piede_s6 = true then false else true;

So if the variable is true (and the word is in the report) then print it.

Unfortunately it seems not working. After some try I've tried to check the variable value and appears that in the page footer is false. So it seems that for some reason the variable doesn't remain in the same state of the details.

Am I doing something wrong?

Thanks for answers
[IMG]smileys/smiley1.gif" align="middle" />


EDIT

After many test it seems that it takes the last row without considering the remaining.
The strange part is that I put visible the variable in the details and at the same time in the report footer and obtain that thing

blabla [false]
blablas6 [true]
blabla [true] *correct because when the variable change doesn't change anymore

variable in the page footer.... [false]!!!

It seems that is considering only the last row despite the value in the last row is true.

Really dunno...


Edited by nalfein - 13 Jun 2013 at 2:24am
IP IP Logged
kevlray
Admin Group
Admin Group
Avatar

Joined: 29 Oct 2009
Online Status: Offline
Posts: 1587
Quote kevlray Replybullet Posted: 13 Jun 2013 at 5:17am
One, I never have good luck with my variables to default as global.  If I want the variable to keep it's value.  I set my variables to be shared (i.e, Shared BooleanVar flg_stampa_piede_s6;).  Secondarily, just because I am an old programmer.  I always define my variables at the beginning of the code (shouldn't matter though).
IP IP Logged
nalfein
Groupie
Groupie


Joined: 07 Jul 2008
Online Status: Offline
Posts: 47
Quote nalfein Replybullet Posted: 17 Jun 2013 at 9:07pm
Nm. Was my fault.
I've put the variable declaration in the detail row so he'll reset every time the value.
I'm stupid
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.031 seconds.