Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Cross Tab - Days per month Post Reply Post New Topic
Author Message
Goldberg
Groupie
Groupie
Avatar

Joined: 15 Apr 2011
Location: Portugal
Online Status: Offline
Posts: 58
Quote Goldberg Replybullet Topic: Cross Tab - Days per month
     Posted: 27 Feb 2012 at 4:57am
Hello,


Is it possible to have, let's say, a cross tab with 2 columns and, based on a selection of a certain parameted listing all the 12 months, it would add the number of day and a line corresponding to each day of the month?

For example,

I have a parameter with the months "Jan, Feb, Mar..."
Let's say I selected the month "FEB"
It would check how many days does the February of 2012 has and it would list them on the crosstab like this:

Days |  "Line" collumn |
   1    | __________    |
   2    | __________    |
   3    | __________    |
   4    | __________    |
   ...   | __________    |
  29   | __________    |


Thanks


Edited by Goldberg - 27 Feb 2012 at 4:58am
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
Quote lockwelle Replybullet Posted: 28 Feb 2012 at 5:14am
you could, if you had a table of dates, or a stored proc could be crafted that would do that.
 
unfortunately, the bottom line is that you need create a datasource that will return this.
 
well, then again, you just want a list, and don't want to display any data associated to the date, you could probably do it in a loop and buiild a string.
 
something like:
local datetimevar startDate := cdate(year(today), {?monthParameter}, 1);
local stringvar crlf := chrw(13) + chrw(10);
local stringvar tab := chrw(9) + "___________________________" + crlf;
local stringvar result := "";
 
do(
  result := result + totext(DAY(startDate) + tab;
  startDate := DATEADD("d", 1, startDate);
)
loop while MONTH(startDate) = {?monthParameter};
 
result
 
 
the syntax might be a bit off, but that is the idea.  Create a big string to display, and check if you are at the end of the month.  The parameter would need to be a number, and you would want to set the text object to Can Grow.
 
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