Crystal Reports no summary is allowed for formula - crystal-reports

I have seen several examples that say you can create a running total, but that doesn't work for me either. Here is my data from Oracle:
Select 19000 as sales, 'Ted' as teammember from dual
union select 150000, 'Bob' from dual
union select 80000, 'Sally' from dual
union select 8000, 'Sally' from dual
My formula for commission:
If sum({Command.SALES}, {Command.TEAMMEMBER}) *.2 < 20000
then sum({Command.SALES}, {Command.TEAMMEMBER}) *.2
else 20000
My formula for sumval:
whileprintingrecords;
global numbervar sumval;
sumval :=sumval + {#Commission};
I put teammember and sales in the Detail section. I put Commission and sumval in the Group Footer. I want total sales and total commission in the report footer.
It won't let me create a summary, so I put commission and sumval in total. The value 41,400 would be correct. The existence of Commission in the Footer does not affect the value of sumval.
My report is like this:
Bob 150,000 20,000 20,000
Sally 8,000
sally 80,000
88,000 17,600 37,600
ted 19,000 3,800 41,400
total 257,000 3,800 45,200

You can create another new formula, let's call it SumvalTotal, and do this:
whileprintingrecords;
global numbervar sumval;
sumval;
And place this in your report footer. You can use this for both your Comission and Sumval columns, since they should be the same.
That should get you:
Bob 150,000 20,000 20,000
Sally 8,000
sally 80,000
88,000 17,600 37,600
ted 19,000 3,800 41,400
total 257,000 41,400 41,400

Related

Grand total with each summation in crystall report

I have data like this
Type Buy Sell
Car1 23000 15000
Car2 24000
Car3 25000
I used sum(#buy) for total buy field and sum(#sell) for total sell field.
Can I sum all or grand total that like sum(#buy) + sum(#sell) ?
because when I run in VB6 for preview that report, Grand total not show on, please help me master.
For this there are 2 approach.
Via Formula :- add a formula field and in that add give above condition in formula field editor. put this field in your desired location, but ideally put in report footer or group footer(if any).
Use running total or summary total.
Check this links
Crystal Report Sum of a Column data
https://forums.asp.net/t/1971464.aspx?Sum+of+Total+in+Crystal+Report+

Crystal Reports using running total in group footer 1 in group footer 2

I need to use the total of my running total in group 1 in the formula group 2 to calcalute the percentage.
Formula 1 (in my header):
whileprintingrecords; shared numbervar RunA; RunA:=0
Formula 2 (in my details):
whileprintingrecords;
shared numbervar RunA;
RunA:= RunA + {#usdequiv}
Formula 3 (in my footer):
whileprintingrecords; shared numbervar RunA; RunA
Results when printing:
Group2 Amount Percentage
Bank 1 1000.00 7.14% (1000/14000)
Bank 2 2000.00 14.28% (2000/14000)
Bank 3 4000.00 28.57% (4000/14000)
Bank 4 7000.00 50.00% (7000/14000)
Group1 TOTAL 14000.00
I need to calculate the Percentage amounts, which I've added above, but can't get the total (formula 3) into my calculations. It just keeps on reading the running total.
My amount field I could not do a summary on so had to create the running total.
I had the same problem. Managed to change the SQL that feeds the report and then used a formula to do what I want. In your case, the formula could be something like this:
count({details},{group2})
...and then use it on group2 header.

Subreports in Crystal Reports

Is it possible to create a single report in Crystal report showing the 3 lists that get information form only 1 main table?
This is my main table which I pulled out from a database and used full outer joins to AccountNum1 and AccountNum2, leading to the blank values in some rows:
AccountNum1 ActDate SuspDate AccountNum2 EntryDate Charge
12345 01/01/2001 12/12/2012 12345 01/01/2012 1.00
67890 02/02/2002 11/11/2011 67890 02/02/2012 1.00
<Blank> <Blank> <Blank> 23456 03/03/2012 1.00
34567 04/04/2004 12/12/2012 <Blank> <Blank> <Blank>
For the 1st report, I want to display all records with complete entries:
AccountNum ActDate SuspDate EntryDate Charge
12345 01/01/2001 12/12/2012 01/01/2012 1.00
67890 02/02/2002 11/11/2011 02/02/2012 1.00
For the 2nd report, I want to display all records that have entries for AccountNum2, EntryDate, Charge only
AccountNum EntryDate Charge
67890 02/02/2012 1.00
For the 3rd report, I want to display all records that have entries for AccountNum1, ActDate, SuspDate only
AccountNum ActDate SuspDate
34567 04/04/2004 12/12/2012
I need to be able to show the information in a single report and also summarize the count of entries in report1, report2 and report3.
Thanks for all your help.:)
This IS possible in Crystal via a workaround:
Add a formula that defines which section you want the row in, eg SectionNo:
Formula might need changing depending on your logic
If (Not Isnull(AccountNum) and Not Isnull(ActDate) and Not Isnull(SuspDate) and Not isnull(EntryDate) and Not Isnull(Charge) then
1
else if (Not Isnull(ActDate)) then
2
else
3
Now you can add a group by the new formula, this will separate the rows into the three sections.
Next add two new detail sections and setup detaila, detailb and detailc to show the fields you want in sections 1, 2 and 3.
Finally add 3 formulas to the three detail sections suppression formula:
DetailA enter "SectionNo <> 1"
DetailB enter "SectionNo <> 2"
DetailC enter "SectionNo <> 3"
If you need a hand setting it up let me know.
No this is not possible in crystal report, you have to create two sub report for second and third listing.

How can I report a percentage of the total count in the detail of a crystal report?

I'm trying to get the total count of employee ids so that I can use it as the basis for a percentage in my report. I'd like my report to look like this:
Types With Email
Customer 20% 15%
Vendor 40% 80%
Employees 40% 75%
Total People: 100
In my view I have the employee id, type and email address. I can get the count and the first percentage (percentage of customers, vendors and employees). What I'm have trouble with is the percentage of customers or vendors with email address. I've tried using formula fields and summaries, but haven't gotten too far with them. Can anyone point me in a direction?
Create a formula to calculate email-address presence:
//{#has_email}
If Isnull({employee.email}) Then
0
Else
1
It doesn't need to be added to the canvas.
Create a formula to calculate the % total:
//{#email %}
// summarize number of email address for a given type
Local Numbervar Total := Sum({#has_email}, {employee.type});
If Total <> 0 Then
Total / Count({employee.id}, {employee.type}) * 100
Add to group header or footer and format with %.

counting fields based on group in crystal report

hi all i wana ask a question about crystal reporting in vs 2008
lets say i have a report with these data
customer_ID Customer_Name Order_amoont Order_Date
(#group1 VipCustomer)
1 xyz 3 1/1/2010
2 abc 4 2/2/2010
5 sds 21 3/12/2009
(#Group2 NormalCustomer)
3 tyt 2 3/3/2010
4 ha 4 21/3/2009
i want only to display records where Order_Date year is in 2010 only so i went to the section expert and i added a condintion in suppress formula Year(order_Date)=2010 and i get the result ,,the question is how to count how many vip customers ordered in 2010 only and how many normal customer order in 2010 only ,,then i want the total number of both type of customers to be displayed to have a report like that::
customer_ID Customer_Name Order_amoont Order_Date
(#group1 VipCustomer)
1 xyz 3 1/1/2010
2 abc 4 2/2/2010
subtotal 2
(#Group2 NormalCustomer)
3 tyt 2 3/3/2010
subtotal 1
total 3
i know that answer ,and i will answer it
1-make a conditional formula field and add to it this condtion
if year(Order_Date)=2010 then 1
2-then add summary to the formula filed
--to get total place this summary in the report footer
--to get sub-total place this symmary in group footer
there is also another way to do it
by using running total field and it evaluate section us the formula year(Order_Date)=2010
then to get total place the running field in report footer
to get sub-total make a new running field the same as the 1st but in the reset section check on reset of change of group and place this field in group footer
thnx