Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Not Always Printing Columns Post Reply Post New Topic
Author Message
KMendels
Newbie
Newbie


Joined: 24 Feb 2012
Online Status: Offline
Posts: 14
Quote KMendels Replybullet Topic: Not Always Printing Columns
     Posted: 05 Mar 2012 at 10:44am

The report I am creating is to accept a Thru Date (let's say the user will enter 2/29/12).  The columns will be FY2012, FY 2011, Feb 2012, Feb 2011, Jan 2012, Dec 2011, November 2011, Oct 2011, August 2011, July 2011 (all the way to the beginning of the fiscal year).

All those columns are separate formulas.   I created 12 such formulas.
 
How can I sometimes print out those columns, but other times not?  If I ran the report with a Thru Date of January 31, 2012 I obviously won't need a column for Feb 12.   But if I run the report with a Thru Date of 3/31/2012 I will need Feb (and now March) to print.   How can I get it not to print?
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
Quote lockwelle Replybullet Posted: 05 Mar 2012 at 12:39pm
you can go to each cell on the report and put in a supression formula (general tab of formating the object, I believe).
 
something like:
MONTH(fiscalDate) > MONTH({?thruDate}
 
you want an expression that evaluates to true for when you want to hide the column.
 
IP IP Logged
KMendels
Newbie
Newbie


Joined: 24 Feb 2012
Online Status: Offline
Posts: 14
Quote KMendels Replybullet Posted: 06 Mar 2012 at 7:50am
Thanks - would I do the same thing for the column headers?
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
Quote lockwelle Replybullet Posted: 06 Mar 2012 at 7:53am
I would think that you would do it for all objects in the column.
 
The column headers, now that I think about could go either way...depends on what you/your boss/users want...if they want to see future fiscal columns, even if empty.
 
I would go with hiding them myself, but that is just my opinion
 
HTH
IP IP Logged
KMendels
Newbie
Newbie


Joined: 24 Feb 2012
Online Status: Offline
Posts: 14
Quote KMendels Replybullet Posted: 06 Mar 2012 at 8:32am
Thanks - and one last question, how can I make the columns stop at the beginning of a fiscal year?
 
For example, if the user enters a Thru Date of 2/29/2012 - I want columns to appear from 7/2011 through 2/2012.  If the user enters a Thru Date of 6/30/2012, I want columns to appear of 7/2011 through 6/2012.
 
How can I get the columns to start with July?
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
Quote lockwelle Replybullet Posted: 06 Mar 2012 at 9:09am
that one is a tougher one... only because you have 12 formulas...
 
I think that I would figured out how to offset the report, so that column 1 is always the starting column (the from date).  I realize that this is a harder task, but will make the report for years to come.
 
Since I don't know how the formulas are designed, I can't really assist with that, but a simple idea would be something like:
local datetime sDate := cDate(YEAR{?start}, MONTH({?start}), 1);  //forcing for the entire month, you could if you want just set the date to the parameter
local datetime eDate;
//formula specific
sDate := DATEADD("M", x, sDate);  //add the number of months that this formula represents 0-11
eDate:= DATEADD("M", 1, sDate);
eDate:= DATEADD("d", -1 eDate);
 
if {table.date} in sDate to eDate then
  //is visible
else
  //is not visible (could be as simple as "" )
 
for the column titles you would just need the part through the sDate := dateadd... and then:
totext(MONTH(sDate), 0,"") + "/" + totext(YEAR(sDate), 0,"")
 
 
HTH
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