how to create a crystal Report with condition - crystal-reports

I have a table like this image.
I want to create report from that table with condition.
I want to sum if Purpose Column is Banana then sum LoanAmount. Example: On the table There are 2 records of Purpose= "Banana" So LoanAmount will be 120000 for Banana. I also want to sum LoanAmount if LoanStatus="UC" and so on. How can i create that report?

One option is to simply insert a CrossTab in the report header or footer. Set rows to 'Purpose' and value to sum as 'Loan Amount'.
Another option is to create 3 formulas. The one for 'Banana' would look like:
IF {Purpose} = "Banana" Then {LoadAmount} ELSE 0
Then SUM those formulas to get the totals.
You can also use a Running Total with an evaluation condition but the approaches above are better.

Related

category wise report in single page

I have a table like below image
I wank to create a report like following image
I have created three formula field for filter Banana, Potato and Corn. Formula code is here:
if {Table1.Purpose}='Banana' then
{Table1.LoanAmount}
else
0
if {Table1.Purpose}='Potato' then
{Table1.LoanAmount}
else
0
if {Table1.Purpose}='Corn' then
{Table1.LoanAmount}
else
0
I also created three formula field to sum Banana, Potato, Corn. Formula name is SBanana, SPotato, SCorn
sum({#Banana}), sum({#Potato}), sum({#Corn})
And i insert it in my crystal report. But my report not show like this image. It shows four pages for four records. How can i create report like above image?
Insert 3 CrossTabs in the Report Footer a, b, and c, each with a different element controlling the row.
Another (more complex) option is to use subreports.

How to implement a conditional fomula in Crystal Report

I have a table named tblRecovery with 4 column. ID, LStatus, Amount and RecoveredBy I created a formula to sum Amount Column where LStatus Column value is "WCL". I use following code.
It sum all value of Amount column without condition. I want to sum amount column if Lstatus Column value is "WCL". How can I do that?
if {tblRecovery.LStatus}='WCL' then sum({tblRecovery.Amount})
Crystal Reports formulas work on a per-record basis.
Your current formula shows the sum of tblRecovery.Amount on every single row where LStatus='WCL'.
To get the desired result, create a formula-field with following formula and the create a sum of it:
if {tblRecovery.LStatus}='WCL' then
{tblRecovery.Amount}
else
0

how to count row in crystal report

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

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

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?