Subreports in Crystal Reports - 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.

Related

Crystal Reports SUM formula help. Don't SUM values with specific IDs

I have a table with rows of Invoice data and I want to SUM the values of all line items where the Item ID is not equal to 0000 or 9999.
The Item IDs I want to exlcude 0000 and 9999 never change.
ITEM ID
NAME
WORK VALUE
TOTAL COMPLETED
0000
HOLD 1
0.00
1,234
1234
MATERIAL A
333.00
76.00
1235
MATERIAL B
567.00
7043.00
1236
MATERIAL C
981.00
321.00
1237
MATERIAL 4
430.00
5445.00
1238
MATERIAL 5
10.00
897.00
1239
MATERIAL 6
18.00
654.00
1240
MATERIAL 7
882.00
3.00
1241
MATERIAL 8
777.00
65.00
9999
ZY HOLD
0.00
111.00
So the value returned in the report from the example above should = 18,502.00 not 20,847.00
I have tried:
IF NOT((TONUMBER({Invoices.InvoiceItems~ItemNumber}) = 9999))
THEN
(SUM({Invoices.InvoiceItems~InvoiceValue})+SUM({Invoices.InvoiceItems~TotalCompleted}
but this doesn't work, it still sums the value from the 9999 line item
I would create a Running Total Field to accomplish this.
A Running Total Field works very similar to the Summary Field, but allows a lot more control over which records are evaluated when summarizing the data. To setup a Running Total Field for your needs try the following steps.
Create a new Running Total Field.
Set the "Field to summarize" to use the Total Completed column from your database. Set the "Type of summary" to SUM.
Set the radio button in the "Evaluate" section to "Use a formula", then click the X-2 button to create the formula that will determine if a row of data should be included in the sum or not. Whatever formula you enter here will need to return a boolean value. When this value is TRUE, the row's data is included, and when it's FALSE the row's data will be excluded. I would use the following formula here: TONUMBER({Invoices.InvoiceItems~ItemNumber}) <> 9999 AND TONUMBER({Invoices.InvoiceItems~ItemNumber}) <> 0000
The last thing to do is the setup the Reset conditions for the Running Total Field. This would be used if you were grouping data in some fashion such as by Customer and would allow you to sum the data for a single customer, then reset to zero for the next customer. If you are not using any grouping you can probably just leave this set to "Never".
Click OK to finish. :)
At this point all you need to do is drop the Running Total Field you just created into your report. Be mindful about which sections you place this field within though. If you place it in a header section, you will likely find it doesn't add in the last record in your dataset because the report hasn't printed it to the details section yet. I recommend placing Running Total Fields in Footer sections to avoid this nuance.
I hope this helps! And if you do have some grouping levels that you need help with setting the reset conditions just let me know what the grouping levels are for your report and I can update this answer for you.
You can create a new formula similar to yours:
IF TONUMBER({Invoices.InvoiceItems~ItemNumber}) <> 9999
AND TONUMBER({Invoices.InvoiceItems~ItemNumber}) <> 0
THEN {Invoices.InvoiceItems~TOTALCOMPLETED}
ELSE 0
and then just sum this formula field up.

Sub report links in crystal reports

I have a report having a command object where I have empno and some columns. And I have another command object which also having empno.
For 1st command the parameter is division and based on division I will get some empnos in 1st commnd object and I need to pass this empnos from 1st command object to 2nd command object.
So that the 2nd command object should get some empnos from 1st command object and should display countries based on the matched empnos .
So I linked both command objects empnos in links tab.
Due to some performance issue I am doing like this
Created a sub report with 2nd command object and created empno parameter. Now in sub reports links tab I am passing main reports empno to sub reports empno parameter.
But I am getting non matching empnos data.
Please suggest
Here what I observed in my 1st table have data like this.
eno name division
1 aaa 2
2 bbb 2
3 ccc 2
In my 2nd table I have data like this
eno country division
1 India 2
2 Aus 2
By using 1st method(linking command objects in links tab).
I am getting result like this.
eno name division country
1 aaa 2 Ind
2 bbb 2 Aus
By using 1st method(Sub report approach).
I am getting result like this.
eno name division country
1 aaa 2 Ind
2 bbb 2 Aus
3 ccc 2
I need to get only employees present in both tables using sub report approach.
Please suggest
Hi Siva i am unable to post the image I am getting data like this.In my 2nd table I have onlt enos 1 and 2 .But I am getting all the emps even I used record selection formula also
**eno name division country
1 aaa 2 Ind
2 bbb 2 Aus
3 ccc 2**
when you use sub report for this purpose then you should not link parameters of main report to sub report instead you should use the linked parameter in Record Selection Formula of sub report then your filtering applies to sub report.
for e.g:
pass the parameter to sub report through links (Take care dont link the parameters) then you will get siomething like this {pm-parameter1}.
then go to record selectoin formula and write as
database field = {pm-parameter1}

Cross tab report in Crystal Report

I am quite new to cross tab type reports in crystal report and I want to show multiple users multiple details.
So that I have columns as username and row containing details of the same.
Like:
User1 User2 User3 User4 User5
Details1: aaa bbb ccc dddd eeee
Details2: 123 345 534 566 87667
Details3: geg dhrth htrhytr ghdf ytryr
But I am unable to get the interface as total, subtotal summary etc fields are quite confusing.
Also I am not interested in grouping my rows on the basis of one field and then showing details in it.
Create a cross tab report and in Row area you put Your details and in column are you put your user, and don't forgot to put the Summarized fields. It works fine. No need to do any coding all the things should manage from your stored procedure.

Crystal report pass last row data in each group to parent report

I have some question about crystal report pass value from sub report to parent report.
Now I have a sub report group by userID.Now I want to Pass last row Data each UserID . forexample sub report like this:
UserID : Jack
id No Time Diff
1 1 08:10 0
1 2 08:20 10
1 3 08:35 15
Last Row: 1 4 09:10 35
UserID : Peter
id No Time Diff
2 1 08:10 0
2 2 08:40 30
2 3 08:45 5
2 4 08:55 10
Last row: 2 5 09:00 5
Parent report need like this:
UserID No Time Diff
Jack 4 09:10 35 (show last row for jack in sub report)
peter 5 09:00 5 (show last row for Peter in sub report)
How to pass last row for each user to parent ? How can I archive this function?
I realize this is an old question, but hopefully this will still be of use to you.
Since you are returning multiple values to the main report, and the number of total rows is undefined, it may be easier to do the following:
Create a second subreport that is a copy of the first subreport
In the detail section of the new subreport, add the following code to the Suppression formula for the detail section: Next ({YourTable.id}) = {YourTable.id}
Basically, the formula will suppress the detail record if the next record's id is the same as the current id. This way, only the last record for each id will be shown.
You can format the detail line in the second subreport to appear how you want.
The only downside to this is that the subreport will essentially run twice, so if it's a slow report, your report just got slower.

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