Require multiple pages for a single bar chart in Crystal Reports 2008 - crystal-reports

I am creating a bar chart where the values are the maximum of an AVE_ZSCORE field, and this is set as "on change of" a PARTICIPANT_CODE field. On any given occasion, I could have up to 250 records in this chart and therefore I need to split the chart over a number of pages. This number of records is dynamic however, and can range between 150 and 250 records.
I have tried the solution in this thread http://www.tek-tips.com/viewthread.cfm?qid=1257385 and I've followed the instruction as best as I understood (please bear in mind that I'm quite new to Crystal Reports). I created a formula, inserted it in the details section which I then suppressed, then inserted a group on that formula, and inserted the chart in the group footer section. The formula I'm currently using (which I called "chart") to test this out on 4 records is:
WhileReadingRecords;
numbervar cnt := cnt + 1;
if cnt in 1 to 2 then 1 else
if cnt in 3 to 4 then 2
My problem is that the output of this results in 3 graphs of the following instead of 2 graphs containing 2 records each:
a group output of 0.00 which has all 4 records (B2, BB, KK, MM) in
one graph
a group output of 1.00 which has only one of the records (BB)
a group output of 2.00 which also has only one record, which is the
same record of the previous graph (BB)
If I change the formula to display as follows:
WhileReadingRecords;
numbervar cnt := cnt + 1;
if cnt in 1 to 4 then 1
Then the output becomes
a group output of 0.00 which has all 4 records in one graph (B2, BB,
KK, MM)
a group output of 1.00 which has one record (BB)
So firstly, I don't understand the formula that I'm using or how it works, and secondly I have no idea how to get this working so that I can easily specify the number of columns per chart

Unfortunately it's hard to say something without total understanding of your report layout. Some screenshot will easy things alot. As nothing yet specified I expect you have only one (mentioned) group in your report.
To achieve you goal you should render your chart as many times as different group values will be. This is how details section of group is rendered. Not footer or header. As chart can't be added to details section additional dummy group should be created. So in result there will be 2 groups:
Outer group (#1) will be based on your formula field and have no header/footer
Inner group (#2) will be used to show chart in either header or footer
Group #2 can be based on same formula as group #1 (or any other formula/field, it shouldn't matter).
Btw, instead of calculating count manually, like in your code
WhileReadingRecords; numbervar cnt := cnt + 1;
You can use Running total fields, with type of summary count on any field you want to control. Such fields are very customizable, so you'd like them.

Related

crystal reports sum only last item in detail

I wish to display in the group footer the sum of the sold qty column (which is easily done) and then only the last value of the on hand qty column.
I think a variable can do this, but not sure how to do it as I'm new to Crystal and its variables.
Here is an example
Sold qty On Hand Qty
details 1 5
2 3
============================================
GF Total 3 3
============================================
details 6 10
3 7
============================================
GF Total 9 7
Put the field {yourTable.OnHandQty} in the group-footer.
This will show the last detail value and will work as long as there's no suppression on details.
Note: The "last record" is determined by the sort within the group. This means that if the sorting is changed, the wrong value will be displayed.
Yes !! You can do this using variables.
Step 1: Create a Formula Field Named as OnHand
OnHand
shared numbervar OnHand;
Onhand := (Your Table Field) + Onhand +;
Place this one in Details section and suppress it (Right Click
Formula --> Format Field --> Common --> Supress)
Step 2 : Create one more formula to display the result
PrintOnHand
shared numbervar OnHand;
OnHand;
Place this formula in Group Footer
Step 3 : Create one more formula Clear
Clear
shared numbervar OnHand;
OnHand :=0;
Place this formula in group Header and suppress it. (This is to clear the Onhand
Value for every records or group).

Reset count after grouping on crystal reports

I am writing a report on Crystal Reports 2013. I'm doing multiple groupings on the report and basically, I want a field to be displayed on the first instance of the second group.
Below illustrates what I'm trying to do:
Group 1 a
Group 2 a
Display
Group 2 b
Not Display
Group 2 c
Not Display
Group 1 b
Group 2 a
Display
Group 2 b
Not Display
etc…
Any ideas on how this can be done?
Put this in the suppresion-formula of the field
(Replace {Table.FirstGroupCol} with the column you used to group Group1:
Not (OnFirstRecord Or (Previous({Table.FirstGroupCol})<>{Table.FirstGroupCol}))
This will only display the field on the first record or if the previous value of the column used for Group 1 is different from the current one.

Crystal Reports 2 column crosstab

Using crosstab expert in CRpts, populating the columns selection with 2 column names and using preview, report has I cannot tell what is what. Report has helpdesk total by date and out of that total there is a group count for another dept. Report looks great with one column selected. However, once I select a column fr db and select it to the columns with Crosstab expert, the columns in the report preview are displayed but hard to tell what is what since I get No and Yes columns. I also have Keep Groups together, column totals on top, and Row totals on left "checked" out.
I want to be have: grand toatl column(for helpdesk) total for Dist. Classrooms afected totals
Can you help? I am also new to CR and have not been able to make a "hit" researching.
Based on the above, I want a report to look like:
(col 1) (col 2) (col 3
Date Group District Classes Affected
Crosstab expert has: 2 rows, 2 summaries(sum on date and grandtotal on top), 1 col(which works great with only col 2 used as column but not when I include col 3).
District is count of district's in group
Classes Affected is count of groups count.
Is this better?

Conditional Running Total in Crystal Reports

Using VS 2008 Crystal Reports, I would like to do a running total on a formula that is calculated on a group change. When I click on add a running total, this formula does not appear in the Available Tables and Fields list.
This is the logic:
On Change Group of group
if CalculatedValue > 0 then
ReportRunningTotal1 += CalculatedValue
else
ReportRunningTotal2 += CalculatedValue
Can I specify a condition in a running total? If not, how else could I do this?
More info: I am doing a running total called GroupRunningTotal of the value of db field BillableHours. At change of group, I am comparing GroupRunningTotal to a db field for that group MaxHours, and I display a result of MaxHours - GroupRunningTotal at the group level.
Appropriate today - Think of it like the electoral college - the person who wins the election does not depend on total number of votes, but of number of votes in the electoral college.
I'm interpreting your question to mean that you want to add up all the negative values in one running total (RT_Neg) and all the positive values in another (RT_Pos). How about this:
Make the RT_Neg running total. Under Field to Summarize, sum your {Tbl1}.{Amount}. Under evaluate, enter "{Tbl1}.{Amount}<0" as your custom formula. Never reset.
Make the RT_Pos running total. Under Field to Summarize, sum your {Tbl1}.{Amount}. Under evaluate, enter "{Tbl1}.{Amount}>0" as your custom formula. Never reset.
Insert both running totals in the group footer (if you put them in the header, it may not sum properly)
Alternatively, you can:
Make a custom formula "If {Tbl1}.{Amount}<0 then {Tbl1}.{Amount} else 0" and make a running total based off that.
I think one of these 2 options will get you to your goal.
You most likely cannot use one RT field as condition for other RT field. You can use formulas, placed on group footer and evaluated 'whileprintingrecords()'; in these formulas you can assign/sum into some variables and display these variables at the end of report. About like next (generic idea only, you need initialization and display routines as well):
numbervar rtcurrent := sum({somefield}, {groupfield});
numbervar rtplus;
numbervar rtminus;
if (rtcurrent > 0)
then rtplus := rtplus + rtcurrent
else rtminus := rtminus + rtcurrent;

Referencing the last row's data in Crystal Report

I have a report where the fields come from data pulled from a SQL server. I have a total field that i have added to the report...however i have an interesting conundrum--i was hoping someone had a formula i could use.
Three of my columns do NOT need summation...however my project requirements are telling me instead to just pull the last number from the last row in the report and putting that in the total row. To better clarify:
1999 0.1% 0.2% 0.3%
2001 -2% 0.3% 3.4%
Basically, in the total field, i'd be pulling the values from 2001 since it is the last report row. In my total row, i want to have -2%, 0.3% and 3.4% showing (since those are the last row's values). SO basically, i just want to pull the last report row's data (NOT total it).
Anybody have a formula i can use for this?
If I read this correctly, I typically would just put the fields themselves in the footer, without any formulas. The report should display the values from the last record in the group.
Well, I have two formulas you can use... I think the only way to do this is with a variable to capture the final value in the details section, and then display it in the group footer. So, in details, create formula field like this:
shared CurrencyVar lastValue;
if (OnLastRecord) then
lastValue := {my_table.field_name}
Add this to your details section and suppress it (so it doesn't display). Then add another formula like this:
shared CurrencyVar lastValue;
lastValue;
Add this to your group section where the total would normally go.
You will need another set for formulas for each field you need to handle this way. Note that you could handle all the fields in the first formula if you use basic syntax (so you can have multiple statements under the 'if').
I would like to share my example.
I should keep last modified value in details and represent in group.
In details I have:
shared NumberVar X1;
if {Q.SklID}={#InSkl8} AND ({Q.Poredak}=1 OR {Q.Poredak}=2) then X8:={Q.MCena};
and in group I have following formula:
shared NumberVar X8;
X8;
This way, I escape situation to have NULL in group formula because I don't have else clause in details formula.