Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Conditional print Post Reply Post New Topic
Author Message
nalfein
Groupie
Groupie


Joined: 07 Jul 2008
Online Status: Offline
Posts: 47
Quote nalfein Replybullet Topic: Conditional print
     Posted: 29 Oct 2009 at 2:13am
Hello all

I've a problem with the conditional print of a box

In the details section of the report I can have many entries and one of them is i.e. "Apple" so:

1 Orange
2 Tomato
3 Apple

Those value can be there or not so in some case I can have only point 1 and 2

In the footer section I've a box that have to be printed only if in the details there is "Apple" code.

I've tried to put in the suppress section of the box this code

if trim({tablefield.tablefield}) = 'Apple' then
    false
else
    true

And is working, but only if the "Apple" value in the details section is the last line. If I have

1 Apple
2 Orange
3 Tomato

The box doesn't appear

I need that the box appear if the "Apple" code is in one line of the details section regardless if is at 1st, 2nd, 3rd or wherever.

It is needed that the box is in the footer section and cannot be in the details because in this last way it will be printed each line.

Any idea?

Thank you in advance for answers

Edited by nalfein - 29 Oct 2009 at 2:14am
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
Quote lockwelle Replybullet Posted: 29 Oct 2009 at 6:31am
create a variable and use that as the trigger to the footer.
in group header
shared booleanvar apples:=false;
""//to hide the false
in the details
shared booleanvar apples;
if {table.value}="Apples" then apples:=true;
"//
 
in the footer suppression formula
shared booleanvar apples;
not apples  //if apples was displayed we want it, but if no apples, then hide
 
hope this works for you.
IP IP Logged
nalfein
Groupie
Groupie


Joined: 07 Jul 2008
Online Status: Offline
Posts: 47
Quote nalfein Replybullet Posted: 30 Oct 2009 at 1:34am
Originally posted by lockwelle

create a variable and use that as the trigger to the footer.
in group header

shared booleanvar apples:=false;

""//to hide the false



Sorry I've not understood where exactly in the header I've to put this formula.


in the details

shared booleanvar apples;

if {table.value}="Apples" then apples:=true;

"//

 



And this one too in the details


in the footer suppression formula

shared booleanvar apples;

not apples  //if apples was displayed we want it, but if no apples, then hide

 



I've also another box in the footer if I put this code in the footer suppression formula I will suppress also the box, can I put this code in the suppress section of the single box?

Thank you for answers ))
hope this works for you.
[/QUOTE]
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
Quote lockwelle Replybullet Posted: 30 Oct 2009 at 6:20am

for the header, you create a formula and then place the formula on the header....where doesn't matter, you are not going to see it, it is just going to execute.

For the footer, yes, you can move the expression to suppress just one control...right click, format the control, general tab, suppress (x-1) button.
IP IP Logged
nalfein
Groupie
Groupie


Joined: 07 Jul 2008
Online Status: Offline
Posts: 47
Quote nalfein Replybullet Posted: 02 Nov 2009 at 7:30am
When i try to create a formula with syntax

shared booleanvar apples:=false;

The system says that "A variable name is expected here"

I've substitued apples with the real value of the variable but it seems to be useless
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
Quote lockwelle Replybullet Posted: 02 Nov 2009 at 8:22am
looks correct. have you tried:
shared booleanvar apples;
apples:=false;
just a thought
IP IP Logged
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