Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: Accessing cross-tab header values in formulas Post Reply Post New Topic
Author Message
wbbroyles
Newbie
Newbie
Avatar

Joined: 17 Dec 2009
Location: United States
Online Status: Offline
Posts: 8
Quote wbbroyles Replybullet Topic: Accessing cross-tab header values in formulas
    Posted: 22 Feb 2010 at 8:49am
One of the great things about cross-tabs is that the columns are dynamic; in my case, I let the user choose a range of months for the report, and the columns get added dynamically.

However, I would like to set up a formula for the column that would act differently based on the value of the column.  My report contains start and end dates for projects and their planned hours, and I want to calculate the number of hours for the month represented by the column I'm in.

                    Month 1              Month 2                 Month 3
Project 1          14                      20                          0
Project 2           0                         0                         100

I can calculate the individual summarized values if I can determine the month/year of each column, for example by checking to see if that month/year intersects the planned window of the project.  But how do I know what months and years are represented by each column when they get added to the report dynamically?  Is there a special function like CurrentColumnValue that I can reference?

thanks in advance,
Brad
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 22 Feb 2010 at 9:16am

Not exactly sure what you are looking to do but here is a link that might giev you an ideaon how to use values in headers in CTs to conditionally change your look.

IP IP Logged
wbbroyles
Newbie
Newbie
Avatar

Joined: 17 Dec 2009
Location: United States
Online Status: Offline
Posts: 8
Quote wbbroyles Replybullet Posted: 22 Feb 2010 at 10:13am
Thanks, D, but I actually want to use the column header in a calculation, not for field formatting.  If I could get something equivalent to GridRowColumnValue outside of the formatting section, I think that would help.
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 22 Feb 2010 at 12:01pm

can you explain on a data level what you want to do? Sounds more like you can create a formula field or a Running Total that changes based on your  needs and then dispaly that inthe CT.

I just don't understand what you want to display or how a param interacts with it.
IP IP Logged
wbbroyles
Newbie
Newbie
Avatar

Joined: 17 Dec 2009
Location: United States
Online Status: Offline
Posts: 8
Quote wbbroyles Replybullet Posted: 22 Feb 2010 at 5:14pm
Sure, I want to do a calculation for each column month, but the results of the calculation depend on which month it is. 

                    Month 1              Month 2                 Month 3
Project 1          14                      20                          0
Project 2           0                         0                         100

For each project, start/end date and planned hours, I want to check its start/end dates to see if they intersect with the month that column represents.  If it does, then I will calculate an allocation of how many planned hours belong to that month, which depends on how many workdays are in the month (a formula I've already written).

For Project 1 above, its start/end dates intersect with Month 1, and I calculate that, based on the number of workdays in Month 1, there are 14 planned hours for Project 1 in Month 1.  For project 2, its start/end dates intersect with Month 3 only, and the workdays calculation shows that there are 100 planned hours for Project 2 in Month 3.

So the intersection check and the planned hours calculations for each project in each month depends on what Month 1, 2 and 3 represent.  If I know Month 1 is January, 2010 I can do the intersection check and calculate the planned hours.  But how do I determine that Month 1 is January 2010?

Thanks,
Brad
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 23 Feb 2010 at 7:32am
I am a little confused as you seem to be creating a crosstab column headers and rows and then trying to insert specific calualtions into the cells conditionally rather than have the CT create itself based on the report data. Maybe I am missing something but I am not sure you can do that. ANyway I beleive I gave you what you are asking for, a way to determine what the column header value is. Here is another example:
if gridrowcolumnvalue("table.columnheaderfield") in date(2009,01,01) to date(2009,01,31) then ...
Would be Jan of 2010.
IP IP Logged
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.018 seconds.