Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: Suppress if shared stringvar contains "data" Post Reply Post New Topic
Author Message
server_sap
Newbie
Newbie


Joined: 09 Mar 2011
Location: Germany
Online Status: Offline
Posts: 14
Quote server_sap Replybullet Topic: Suppress if shared stringvar contains "data"
     Posted: 18 Apr 2011 at 1:11am
Hi Guys,
I Have a subreport called 'Module' , that subreport is being printed in details section on main report , this subreport has values for example:
Data1
Data2
Data3
 
now on main report i have also 3 different Logos , i want to create formula and suppress each logo based on subreport data value for example
 
in logo1>Format Graphic>Common (X2):
if subreport (data) = data1 then
false
else
true
 
or something similar , i have tried with shared stringvalue but it refused give me expected result , my main objective is to print logo1 only if subreport has Data1 or same with logo 2.
 
i hope you can help
Regards
Server Sap
 


Edited by server_sap - 18 Apr 2011 at 1:12am
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
Quote lockwelle Replybullet Posted: 18 Apr 2011 at 3:09am
is your image being displayed before or after your subreport.  If it is before...well the variable is not set yet, so it will not display as desired, as it will be reading the prior value of the shared variable.  The way around this is to run the subreport prior to the determination of the image...which means running the subreport twice, unless you can figure out a way to determine if the subreport would have data without actually having to run it...
 
to this end, you might have a command object which could link the results, somehow, or any other type of idea.
 
If the image is being set after the subreport, I don't have a clue as to what is wrong, unless the links to the subreport or the shared variable is being overwritten by accident.
 
HTH
IP IP Logged
server_sap
Newbie
Newbie


Joined: 09 Mar 2011
Location: Germany
Online Status: Offline
Posts: 14
Quote server_sap Replybullet Posted: 18 Apr 2011 at 3:47am
hi lockwelle ,
 
my graphics are in page footer and sub report is in details section as i said , now i have managed to link as below :
in Subreport:
@Shared1
whileprintingrecords;
shared stringvar Module ;
Module := {Table.field};
 
in Main report :
@shared2
whileprintingrecords;
shared stringvar Module ;
 
and placed @shared 2 in details b ( after subreport ) ,and suppressed details b.
 
in graphic>format graphic>common X2:
if {@shared2}= "Data1"
then
false
else true
 
so as i said earlier in my subreport there are only 3 records ( fixed) , but just for testing if i use @shared in details b ( without suppressed ) and preview i see only 1 record out of 3 , however on subreport its showing fine all 3 , i guess either there is huge gap ( vertical blank lines) between records when i use them in details section or shared stringvar is not giving me expected result.
 
but if i use graphic supress formula for that one available record then it works but only for 1 record and 1 logo , i dont know i can i make sure that my @shared shows all 3 records properly .
 
i hope that helps to help me:)
 
Thanks again
Server
 
 

 
 
 
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
Quote lockwelle Replybullet Posted: 18 Apr 2011 at 6:15am
you suppressed detail b, so it does not run the subreport.
 
How we have found to make this work, in the subreport, do not display any values, then in the main report for detail b, go to the section expert and select the option to suppress blank section.  This will 'hide' detail b, and allow the subreport to run.
 
Give this a try, hopefully, you will be able to select the correct Module stringvar.
 
IP IP Logged
server_sap
Newbie
Newbie


Joined: 09 Mar 2011
Location: Germany
Online Status: Offline
Posts: 14
Quote server_sap Replybullet Posted: 18 Apr 2011 at 8:33pm
my subreport is in details a , and its not suppressed , i used details b only for @shared2 formula to call shared string , but first i tried even not suppressing details b too , to see if i am getting all records , but not , i see only 1 record ,
and ya i have tried suppress blank section / embedded fields etc , tried isnull formula too , but norhing works i see only 1 record in main report when i use @shared2 ,
 
i came to conclusion that there is huge gap between records when i use it in main report thats why i see only 1st record , but when i use option' browse field data' i see all 3 records , hence i need some workaround to remove this gap/space between record .
 
Thanks for efforts.
Server
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