Report Design
 Crystal Reports Forum : Crystal Reports .NET 2003 : Report Design
Message Icon Topic: Hiding the fields on Reports Post Reply Post New Topic
Page  of 2 Next >>
Author Message
ashisahb
Groupie
Groupie


Joined: 15 May 2008
Location: India
Online Status: Offline
Posts: 48
Quote ashisahb Replybullet Topic: Hiding the fields on Reports
    Posted: 22 Apr 2009 at 2:07am
Hi Guys ,
 
Can we hide some of the fields in the reports based on some conditions ??
like say ..if the dats is 22/04/2009 , a particular column should be suppressed.
 
 


Edited by ashisahb - 22 Apr 2009 at 2:07am
Regards,
Ashish
IP IP Logged
hilfy
Admin Group
Admin Group
Avatar

Joined: 20 Nov 2006
Online Status: Offline
Posts: 3702
Quote hilfy Replybullet Posted: 22 Apr 2009 at 10:55am
Yes. 
 
To hide specific objects, right-click on the object and select "Format <x>..." where <x> is Field, Formula, etc. depending on the type of object.  Go to the Common tab and click on the button to the right of "Suppress".  Enter a formula that evaluates to True or False.  When it is true, the object will be suppressed.  For your example above, the formula would read something like:
 
CurrentDate = Date(2009, 04, 22)
 
-Dell
IP IP Logged
ashisahb
Groupie
Groupie


Joined: 15 May 2008
Location: India
Online Status: Offline
Posts: 48
Quote ashisahb Replybullet Posted: 23 Apr 2009 at 11:45pm
That worked Clap
 
Mr Dell .....thanks a ton.
Regards,
Ashish
IP IP Logged
hilfy
Admin Group
Admin Group
Avatar

Joined: 20 Nov 2006
Online Status: Offline
Posts: 3702
Quote hilfy Replybullet Posted: 24 Apr 2009 at 6:54am
Actually, it's Ms Dell.  Big%20smile  Since my name is not gender-specific, that's a pretty common mistake.
 
-Dell
IP IP Logged
ashisahb
Groupie
Groupie


Joined: 15 May 2008
Location: India
Online Status: Offline
Posts: 48
Quote ashisahb Replybullet Posted: 29 Apr 2009 at 2:04am
ohhh...am sorry @ that...
 
one more question...
 
Can we dynamiccaly move the column position. Lets say we have 5 columns and we hide 2 and 3 rd one , then 4 and 5 th should move in place of 2 and 3 rd......is it possible????
Regards,
Ashish
IP IP Logged
hilfy
Admin Group
Admin Group
Avatar

Joined: 20 Nov 2006
Online Status: Offline
Posts: 3702
Quote hilfy Replybullet Posted: 29 Apr 2009 at 8:41am
No problem - it happens all the time!
 
There is no way to have Crystal dynamically move them if they're set up as just fields.  However, you could create formulas for the fields that you want to hide and all of the fields to the right of them.  The formula would be in the format:
 
If <hide condition> then <non-hide field> else <hide field>
 
You then use the formulas in place of the fields and use the suppress on the last field to the right.
 
-Dell
IP IP Logged
ashisahb
Groupie
Groupie


Joined: 15 May 2008
Location: India
Online Status: Offline
Posts: 48
Quote ashisahb Replybullet Posted: 30 Apr 2009 at 3:13am
thanks for reply.
 
My client is very specific to the order of fields so cant puch the suppressed fields to the end.
 
we can apply some formulas on the size and position , isnt it?
 
i tried applying something for X Position Adjustment like
if(condition) then 4.32
 
where 4.32 is the new X position , but didnt worked , I am not very sure how to apply formulas here...
 
 
Regards,
Ashish
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4372
Quote lockwelle Replybullet Posted: 30 Apr 2009 at 6:30am

Adjusting the position will work, but there are some conditions.  First the move is in some unit, so if you want to move 1 inch it is 1*1440.  Second, and this is the really hard one, the position in the formula is the RELATIVE distance from the location of the field in design time.

So if you have a field at 1.0, and in the formula you say you want it at 2.0 *1440 (which you would think would locate it at 2.0), your field will end up at 3.0 (1+2).  If you need it to move backwards (to the left) it would be a negative move.
 
I have written only 1 report that is completely dynamic, the order and headers being completely userdefined at run time as a proof of concept.  Only the headers were ever defined and moved, it isn't pretty and maintenance could be a pain, but it work.  Basically, what I had was all of the fields were at the same spot on the report, and then depending on string that was passed into the report, the report would shift each column correctly (accumulating how far it had moved and adding space between each column) to its new location.  All columns not needed were suppressed.
 
The biggest help was creating a custom function to keep track and do all of the moving of the fields.
 
I don't have the report any more, but with this, you might be able play around a create a solution that works for you.
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4372
Quote lockwelle Replybullet Posted: 30 Apr 2009 at 6:33am
it just dawned on me, if you wanted, you could perform the calculations in the app and just pass a formatted string to the report.  The report could then parse the string and move the columns...
 
well its a thought.  hope it points you towards a solution.
IP IP Logged
ashisahb
Groupie
Groupie


Joined: 15 May 2008
Location: India
Online Status: Offline
Posts: 48
Quote ashisahb Replybullet Posted: 04 May 2009 at 5:06am
Hi lockwelle ,
 
I have tried above solution of applying formula , by putting some vale of around 3000 , but didnt worked....may be some issue of binding.
 
So finally dropped the idea and created new template....
 
One more question :
 
Can we terminate the Report Generation dynamically with the help of template, like say...for some X value , process should be aborted and no report should be generated. 
Regards,
Ashish
IP IP Logged
Page  of 2 Next >>
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.