how to count row in crystal report - crystal-reports

I've got data as picture below, i'm using crystal report to display statistic report from that data.
i want to count MRN which got 2 until 5 rows of episode number only.
currently im doing
1) group MRN in crystal report and count(episode number).
2) create 1 formula like :
if count(episode number) >=2 and count(episode number)<=5 then count(episode number)"
3) put the formula to report and try to insert summary to count that formula, but no selection summary appear for that formula.
Can you give me an idea how to count MRN with 2 until 5 episode only? refer to picture for clear explanation

In Crystal you can use two condition types to sort which records are being showed:
Record selection formula
Group selection formula
Both are located in the menu Report > Selection formulas
In your case you can define a group on field MRN and create a Count field inside that group. To show only groups where the count is between 2 and 5, use the Selection Formula > Group condition in the Report menu.
Count ({EpisodeNo},{MRN}) <=5 and Count ({EpisodeNo},{MRN})>=2

Related

calculating the percentage based on the number of records in the crystal reports

In my crystal reports I have a field called "PAYMENT" it has to be displayed according to the following requirement
REQUIREMENT
if there is only one RECORD in detail section then it has to display,
PAYMENT=percentage
if there are MULTIPLE RECORDS in detail section then it has to display,
PAYMENT=percentage+(percentage(total value)+remarks)
can anyone please tell me how to do this?
You can use the following formula in CR to count the records
CountRecords
Count ({Table.PAYMENT})
PaymentDisplay
Then create another formula with your decision making:
If COUNT FORMULA = 1 then DISPLAY OPTION 1 else DISPLAY OPTION 2
I have not tested this but it should work.

Crystal Reports set record number in formula

Would anyone know of a way to manually specify a record number within a formula, in Crystal Reports?
For instance, I have a report linked to an SQL server View that sits on top of a table that contains 20 records. This view selects the fields I need and then orders by the highest value to the lowest.
The report then pulls these records into the report in that order. What I would like to do is to be able to write a formula that can select a record based on its number.
I know I can reference RecordNumber in a formula (i.e. If RecordNumber = 5 Then...) but this only works in the Detail section once it actually shows record number 5, and if I place a formula in the header section it just displays False as the header only shows the first record.
I need to create a formula that sets the record number and then displays the desired value of that record number in the header (i.e. something like:
Set RecordNumber = 5
ToText ({table.value})
Can anyone help or is Crystal just not that sophisticated?

How to calculate % with count base on condition?

I use crystal report, my report have 2 fields : man=3 and woman=4. I want to calculate % man? with formula field. I try count({person.sex},"man")*100/count({person.sex}) but show Error "A field is required here"? Help me!
Take 2 running total variable, put into the group footer or appropriate section (preferable on any footer- report footer will display total percentage, not group wise) and give condition as you want or check below links.
Using a Running Total in a Formula in the Details Section of a Crystal Report
How to sum running total field for each group in crystal report?
http://community.spiceworks.com/topic/117306-crystal-reports-won-t-summarize-or-running-total-my-formula-field
please check this link
http://crystalreportsblog.com/crystal-reports-running-totals/
http://www.experts-exchange.com/Database/Reporting/Crystal_Reports/Q_28044491.html

Crystal Reports: How to suppress all records in group if ONE based off the value of 1 field

I have a report which lists all employee timesheets (grouped). Each employee will have a record for each day (5 records in total) per group. I want to suppress ALL records for a employee if ANY of the 5 records has a value in a particular field (called "uniqueAttachID").
Basically, if the "uniqueAttachId" is blank, it tells me that the record does not have an attachment and I want to see all employees where this is the case. The attachment can be added to ANY of the 5 records therefore, if ANY of the records HAS data is this field, then I want the whole section of the group suppressed.
You can use below trick to achieve your requirement,
1] create a summary on uniqueattachedID across the group. This summary will give you sum of uniqueattachedID column. Suppress this summary.
2] Now go to the Section Expert of the group. Write formula for Suppress.
3] In formula you will write
if summary column (select this from reports field) > 0 then true
else false
I hope this helps!
If you want to suppress ALL records (Group and Detail), you will have to go into Section Expert, and in the suppress formula for each section of your report that you want to suppress, you enter
uniqueAttachID <> ""
That will suppress each section if uniqueAttachID has a value. You may need to adjust the formula if uniqueAttachID is a numeric field.

Hide rows with no values in hierarchial grouping in crystal reports

I have a crystal report - showing some financial data. As normal with financial data we have several general ledger accounts - which are grouped hierarchically. We are using grouping in Crystal report with some totals on hierarchical groups.
There are some rows where the values are zero. The groups also have total of zero as a result of this. We need to hide these rows. If we try to check the sum of the field - on the group level - it hides all the parent rows (since they themselves do not have any value - only values are derived from the child rows).
Need some way to do this in crystal?
You can suppress rows base on a condition.
In the menu go to Report->Suppress Expert...
Select the details line then select the formula button next to Suppress
You only need to put the condition that will be true to suppress the line
{[Your value field]} = 0
For groups, you will need to find the sum of your total for that particular group
SUM({[Your value field]}, {[field you are using to grouped by]}) = 0