Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: Retrieve the Summarized field from the Crosstab Post Reply Post New Topic
Page  of 2 Next >>
Author Message
dhakshu
Newbie
Newbie
Avatar

Joined: 01 Mar 2007
Location: Singapore
Online Status: Offline
Posts: 21
Quote dhakshu Replybullet Topic: Retrieve the Summarized field from the Crosstab
    Posted: 01 Mar 2007 at 12:30am
Hi All!
 
       The crosstab report looks like this.
 
                            Dec             Jan      Feb
-----------------------------------------------------------------         
                      sum      %
-------------------------------------------------------------
           aaa         7     53.84
           bbb         2
           ccc           1
           ddd          3
           Total       13
 
The report is grouped based on the programmes. Monthwise Airtime details of the programmes has to be shown.
 
Apart from the summarized field , I have to include a percentage field.
ie., the percentage is calculated based on a formula not on the total 13.
 
How to retreive the summarized field value from the crosstab report?
How to find the percentage based on a formula rather than the summarized field?
It would be great, If anyone can help me.
 
Dhakshu
IP IP Logged
Valmont
Newbie
Newbie
Avatar

Joined: 29 Jan 2007
Online Status: Offline
Posts: 39
Quote Valmont Replybullet Posted: 04 Mar 2007 at 6:29am
How to retreive the summarized field value from the crosstab report?

This is exactly what I am looking for as well. In fact, I'd like to retreive any field from a crosstab, even from crosstabs in a subreport.

My chief would like to have a summary-report from all the subreports in a special format. I can do it only by formula's but the quest as mentioned above needs to be solved.
IP IP Logged
BrianBischof
Admin Group
Admin Group
Avatar

Joined: 09 Nov 2006
Online Status: Offline
Posts: 2458
Quote BrianBischof Replybullet Posted: 04 Mar 2007 at 9:16am
You can reference the cross-tab fields as the are being printed. However, you can't reference them afterwards. If you need to reference them afterwards, you need to create a global array and populate that array as it is printing the cross-tab. Then in your report you can reference the array as if you were referencing the cross-tab object.

If you read my chapter on cross-tabs, you'll see the formulas for referencing the cross-tab cells and I think I have an advanced tutorial that walks you through some steps as well.
Please support the forum! Tell others by linking to it on your blog or website:<a href="http://www.crystalreportsbook.com/forum/">Crystal Reports Forum</a>
IP IP Logged
Valmont
Newbie
Newbie
Avatar

Joined: 29 Jan 2007
Online Status: Offline
Posts: 39
Quote Valmont Replybullet Posted: 04 Mar 2007 at 11:38am
What chapter. I didn't buy your book (yet).

Also, I can't seem to find it on via this link: http://www.crystalreportsbook.com/CrystalReportsXI.asp
IP IP Logged
BrianBischof
Admin Group
Admin Group
Avatar

Joined: 09 Nov 2006
Online Status: Offline
Posts: 2458
Quote BrianBischof Replybullet Posted: 04 Mar 2007 at 1:52pm
The book isn't for sale yet. I have the chapters online to read for free. Chapter 10 discusses cross-tabs. Near the end is where I discuss how to reference specific cells in the cross-tab object.

http://www.crystalreportsbook.com/Crystal_Reports_XI.asp?Page=10_7

The chapter is broken into multiple pages, so you will have to go back to the table of contents to click on the remaining sections.


Edited by BrianBischof - 04 Mar 2007 at 1:53pm
Please support the forum! Tell others by linking to it on your blog or website:<a href="http://www.crystalreportsbook.com/forum/">Crystal Reports Forum</a>
IP IP Logged
dhakshu
Newbie
Newbie
Avatar

Joined: 01 Mar 2007
Location: Singapore
Online Status: Offline
Posts: 21
Quote dhakshu Replybullet Posted: 04 Mar 2007 at 5:29pm
Hi Brian!
   
    Thanks a lot for your reply.
    Today , I will go through your book, and try to solve my problem.
 
 
 
Dhakshu
IP IP Logged
Valmont
Newbie
Newbie
Avatar

Joined: 29 Jan 2007
Online Status: Offline
Posts: 39
Quote Valmont Replybullet Posted: 05 Mar 2007 at 7:15am

Hello Brian,

That page doesn't answer my question. Let me give you an example:
 
I have two crosstables in my report:
"Crosstable1" and "Crosstable2".
Both of them have various sub-totals in them.
Both of them are the way I want them.
I want to:
- Create formula manually in the formula field on the right pane.
- Type crystal syntax code to add subtotals from both cross-tables.
 
Or perhaps I want to sum the subtotal of "Crosstab1" with total-general of "Crosstab2".
 
So I need to reference any field in the crosstab from within a formula in the formula field on the right pane.
IP IP Logged
BrianBischof
Admin Group
Admin Group
Avatar

Joined: 09 Nov 2006
Online Status: Offline
Posts: 2458
Quote BrianBischof Replybullet Posted: 05 Mar 2007 at 9:37am
Ah - I see. I added some more Advanced Tutorials to the chapter after I already published the chapter to the web. Basically, what you are trying to do isn't actually supported by Crystal Reports. In fact, there is no 'accepted' way of doing what you want. So you have to build some complex code to make it work. I simply don't have time to write the report for you, but I will give you the basics and let you run with it from there. You have to be VERY comfortable with Crystal syntax to get this working.

First off, there is no way to reference each field in a cross-tab object. There is no functionality to talk to the cross-tab object. So what you have to do is build an array which mirrors the cross-tab object. As the cross-tab object is being built you have to populate each array element with the appropriate cell from the cross-tab object. Once the cross-tab is finished you can then use the array for the calculations that you wanted to use with the cross-tab object. Clearly, we're talking very advanced report design (which is why I ended up writing the tutorials after I originally finished the chapter - and now I might have to go back and add another tutorial to demonstrate this problem as well).

The function to get the current value from the Cross-tab cell is CurrentFieldValue. Put that value in the array element. To find out which row or column you are in, use the function GridRowColumnValue(fieldname). To find out the row, put in the row's fieldname. To find out the column, put in the column's field name.

By combining If-then statements with the GridRowColumnValue() function, you can determine which row and column you are on and put the value into the proper cell in the array. Now, this can get complicated, but what you are trying to do is pretty advanced.

Hope this helps.

Please support the forum! Tell others by linking to it on your blog or website:<a href="http://www.crystalreportsbook.com/forum/">Crystal Reports Forum</a>
IP IP Logged
Valmont
Newbie
Newbie
Avatar

Joined: 29 Jan 2007
Online Status: Offline
Posts: 39
Quote Valmont Replybullet Posted: 05 Mar 2007 at 3:14pm
You bet this helps!
I'll experiment with this tomorrow right away after I finished a daily report for our customer.

You see, one of our customers would like us to hand over a daily report with all the critical data in it, ordered by day and month. Many unrelated tables are to be used. In fact, all tables are going to be used. Since this customer is a good customer, I want to give them whatever they ask.
That's the trade.

My solution to this combined report is to create a standard report with all kinds of crosstables in it. That's easy enough.
But after that I need to create the "final" report by combining the crucial fields from all the subreports into a single "final" report. I'm not affraid, only unseasoned :)

Thanks again,
Val


Edited by Valmont - 05 Mar 2007 at 3:21pm
IP IP Logged
BrianBischof
Admin Group
Admin Group
Avatar

Joined: 09 Nov 2006
Online Status: Offline
Posts: 2458
Quote BrianBischof Replybullet Posted: 05 Mar 2007 at 3:27pm
Well, I'm glad this helps. Sounds like a brutal report to work on. I don't envy you.



Edited by BrianBischof - 05 Mar 2007 at 3:50pm
Please support the forum! Tell others by linking to it on your blog or website:<a href="http://www.crystalreportsbook.com/forum/">Crystal Reports Forum</a>
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.020 seconds.