Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: Display division of two variables in CR cross repo Post Reply Post New Topic
Author Message
skyknight
Newbie
Newbie


Joined: 06 Sep 2007
Location: Indonesia
Online Status: Offline
Posts: 1
Quote skyknight Replybullet Topic: Display division of two variables in CR cross repo
    Posted: 06 Sep 2007 at 6:37am
Hi All,

I have design report using cross table in CR and i want to display qty, number of visit and division of qty and number of visit. I have success display qty and number of visit in cross table, but i fail to display correct value for division of qty and number of visit. So how can i display the value for division of qty and number of visit?

For ilustration, please see this image or visit this link:



Thank You for your enlightenment,

Kurniawan
IP IP Logged
jkwrpc
Senior Member
Senior Member


Joined: 19 Jun 2007
Location: United States
Online Status: Offline
Posts: 432
Quote jkwrpc Replybullet Posted: 06 Sep 2007 at 6:24pm

There are others more familiar with cross tab reports than I am. Having said that you may want to consider doing the divison in the SQL query as an SQL expression.

You could add a line something like this to your query,
-------
(quantityfield/numberfield) AS Percentage,
-------
 
What I cant tell you is how to add the expression field to your crosstab report since it is summarizing the data.  Perhaps  you could consider a different style of report.
 
I am sure others on the forum can help. Maybe this will create more ideas from them.
 
Hope this helps, let us know if you find a solution so we can all learn.
 
 
Regards,
 
John W.
 
IP IP Logged
BrianBischof
Admin Group
Admin Group
Avatar

Joined: 09 Nov 2006
Online Status: Offline
Posts: 2458
Quote BrianBischof Replybullet Posted: 06 Sep 2007 at 11:02pm
This is pretty tricky and I dedicated quite a few pages in the new book detailing how it all works. I'll try to give you the quick version here. First off, you can override any value in a cross-tab cell using the Display String property on the Format Editor. Click the Formula button to enter a new formula to be displayed in the cell. This is where you would put the division calculation.

Now, the next question is, how do you create the division calculation. For this, you have to create a Shared variable for both the numerator and divisor. Use the conditional formatting of any property for each cell and assign the CurrentValue function to the shared variable. That way, both the numerator and denominator variables will have values in them so that your division calculation will be accurate.

Again, this is pretty tricky stuff and its tough to explain in a simple forum post. If you decide to pick up a copy of the book, read pages 510-518 for in-depth coverage and examples.
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
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.