SUB TOTAL in crystal report - crystal-reports

I to try to get subtotal of these numbers through formula but sub total is wrong please check this image
check image
image
i use this formula here locamount is feild name and #test is parameter..
if isnull ({#test})
then {dt1.locamount}
else
{#test}
#test parameter
if {dt.acdocno}+{dt.fiscalyear} = {esy.InvRef1}
then
{esy.Invpmt1}
else if
{dt.acdocno}+{dt.fiscalyear} = {esy.InvRef2}
then
{esy.Invpmt2}
else if
{dt.acdocno}+{dt.fiscalyear} = {esy.InvRef3}
then
{esy.Invpmt3}
else if
{dt.acdocno}+{dt.fiscalyear} = {esy.InvRef4}
then
{esy.Invpmt4} ......
above code continue till 50 number comes
i click on insert fields and select formula field then i write formula and save this as SUB_TOTAL then drag this field i.e. subtotal on report
how to solve this

I might be missing something obvious, but... you should be able to accomplish this by using grouping and summaries or running totals
In your report, go to Report > Group Expert. Select the field you want a subtotal on (VendorNo)
Create a running total for the field you want to summarize - If you want to summarize a computed field, then first create a formula for the computed field (say, {dt.acdocno}+{dt.fiscalyear}), then use that formula as your field to summarize in the running total.
The results should look like this
If this isn't what you need, could you provide some detail about the report design and tables used?

Related

Crystal Report: Get Minimum Date

I have this concern using Crystal Report which I am not really familiar with. Here's my scenario:
I have an existing report to update, I need to add a column (ETA) which has a datetime value. It may return more than one rows per Item No, I need to get the minimum date only per Item No from the result rows.
I already tried some solution mentioned here http://scn.sap.com/thread/1952829 but found no luck.
I used a suppression formula for the Details section of the report, but haven't succeeded yet.
IF {TableName.DateField} = Minimum({TableName.DateField}) THEN FALSE ELSE TRUE
Any possible things you can suggest me to try? Thanks in advance for this :)
good to get this value from sqlserver side. you just create a function which return a single data (minimum date).
If you wish in crystal report side, it is something you make loop of hundred for a single row display. You can use running total field for this.
Select the field , select summary type and put into the detail section.
or you can create a formula with group name option like
Minimum({TableName.DateField})
http://scn.sap.com/thread/1952829
http://businessintelligence.ittoolbox.com/groups/technical-functional/businessobjects-crystal-l/unable-to-filter-based-on-the-first-date-in-list-of-dates-4912881
please check
Running total field gives options for Min, Max, etc. but not Sum
http://flylib.com/books/en/4.229.1.28/1/

how to sum the visible fields of a column (not suppressed one) in Crystal Report

I have Crystal Report whose column data is like following:
81306
suppressed (real value was 81306)
Total 81306 (Result Required)
Total 162612 (Result coming which is not required)
I suggest to create a Formula field this way:
IF {rpt.Amount}= previous({rpt.Amount}) then 0 else {rpt.Amount}
[drag the field into the formula]
and then summarize this Formula field instead of the original field.
To summarize the formula field, the easiest way is
1) mouse right button inside the report
2) insert \ summary
3) choose the formula field, SUM as summarize, the Group where yuou want to summarize into

Formula to Sum "amount" column in Crystal report

I have a column name as "Amount" in CR. I need to sum that column.
I created a new formula and tried sum( { MycolumnName} ) and it says
"A number field or currency amount field is required here"
Is there any way to apply conversion in formula itself.
Why create a formula when you can just create a summary field by selecting your column and going to the menu and selecting Insert Summary, Insert Subtotal or Insert Grand Total depending on your needs? You can place the summary field in a group section as a subtotal, or in the report footer as a grand total.
If you need to apply a conversion in the formula, you can use CCur like this:
sum( CCur({ MycolumnName}) )
More information on converting types in Crystal Reports can be found here.
Change the type xs:string to xs:decimal of the column MycolumnName in xs:element in .xsd page

Is it possible to programmatically iterate through a table within a formula in crystal reports?

Is it possible to programmatically iterate through a table within a formula in crystal reports?
E.G. If I have a master table and a detail table can I iterate through the detail table e.g.
( psuedo code )
local numberVar Total := 0
While not EOF()
IF Type = "+"
Total = Total + Quantity
ELSE IF Type = "-"
Total = Total - Quantity
ENDIF
<Next Record>
End While
It is possible to use loops in a formula field to get the data that you need, but I have only really used them in complex string manipulation. If you really need to do this then you may be able to look into using subreports, but you'd need to put the subreport in the details section which is not really recommended because it is essentially like running a new report for each record that is pulled.
It sounds like what you are really looking for is a running total field. If you join the master and details tables together the report will pull all of the rows for both tables. Then you can group by "Type" and create a running total field that sums the "Quantity" field for each row and resets on the change of the group. I think it is a little different way of thinking than traditional programming. Hope this helps.

Crystal Reports: Is it possible to sum for more than one column?

I work on an accounting project in .NET.
I want to sum all transaction and its opening balances.
I use summary but it Allows only one column..
You can summarize within formulas, so long as the formula field is present in the report footer. When using Sum() CR knows to evaluate the expression for all records returned.
So you would create a formula for the report footer, and the formula code would be something like:
Sum({#TransactionAmt1}) + Sum({Transactions.Amount}) + Sum({#AnotherFormula});