How to access crosstab formula field in another column? I have report like with Dues & total both formula fields:
Amount Dues(Done by a Formula) Total (Done by a Formula)
------ ------------------------- ---------------------------
500 20 % someAmount
Formula for Dues:
WhileReadingRecords;
numberVar due:={Command.SomeField)/100;
due
Formula for Total:
WhileReadingRecords;
numberVar total:= {Command.Amount} - due;
total
How do I access due field inside the second formula for each row of record?
Just use {#FormulaName} (See image below)
Crystal syntax is very simple for simple formulas. For your sample formulas, you don't need to declare variables or use WhileReadingRecords. (Both have their uses, but for your sample formulas, they are unneeded). Again, see the image below for an example.
Related
I want to show my Grand Total values by using a specific formula field.
Actually I want to sum formula fiel such as :
sum(#ClosingBalance)
But It gives a message
This Field Can not be summarize
How can I solve this problem ??
I solved my problem,
I explain below how can I solve this,
I need two other function to show grand total in my report footer, where I use formula field as my summarized field.
so, firstly I create a function name #Grouptotal by using below formula
Numbervar x:=x+{#ClosingBalance} And place it in my group footer
Then I create another formula name #GrandTotal and place it in my report footer
Numbervar x:={#Grouptotal}-{#ClosingBalance}
Finally I suppress the #Grouptotal Field , and get the result of #GrandTotal By using Formula Field.
Thanks a lot...
Yes, you can do this using variables.
Step 1: Create a Formula Field Named as Sum1:
Shared numberVar Sum1;
Sum1 := (Your Table Field) + Sum1;
Place this one in Details section and suppress it (Right Click Formula --> Format Field --> Common --> Suppress).
Step 2: Create another formula to display the result as PrintSum1:
Shared numberVar Sum1;
Sum1;
Place this formula in Group Footer and suppress it (Right Click Formula --> Format Field --> Common --> Suppress).
Step 3: Create another formula field:
Shared numberVar GrandTotal;
GrandTotal := GrandTotal + {#Sum1}
This way you can summarize a formula field. Place this one in group footer.
Step 4: Create one last formula as Clear:
Shared numberVar Sum1;
Sum1 := 0;
Place this formula in Group Header and suppress it. This is to clear the Sum1 value for every record or group.
Let me know if you have issues.
I have a crystal report which requires to report on components (RUB_0) that are included on payslips, specifically basic salaries and pension contributions.
Certain employees could have more than one payslip (BUL_0) in a month and as such only the latest (max) payslip (BUL_0) per employee has to be reported since we are working with month to date figures.
My data looks as follows:
BUL_0 DAT_0 RUB_0 AMT_0
1700000018 2017-01-31 00:00:00.000 SALACT_MTD 20000.000000000000
1700000019 2017-01-31 00:00:00.000 SALACT_MTD 40000.000000000000
I have built the following formula which reports correctly for the latest (max) payslip in the detail section of the report.
IF ({HISTOPAYE.RUB_0} = "SALACT_MTD") AND {HISTOPAYE.TYP_0} = 6 AND {HISTOPAYE.BUL_0} = Maximum({HISTOPAYE.BUL_0}, {HISTOPAYE.EMP_0})
THEN {HISTOPAYE.AMT_0}
ELSE 0
Which displays on my report as per the following image which is correct (on detail level)
Current Crystal Output
updated image below:
Updated Crystal Output
When I try to add a summary for one of these formula fields, the "SUM" option is not available, nor is the actual report field. When trying to sum the value manually, crystal returns "This field cannot be summarized" warning.
I have found that the reason for this warning is because my formula above, is creating a constant which cannot be summed. I have tried casting the fields to different data types and have tried setting multiple formula's to reset the value as per the below article, however - it did not resolve my particular issue.
Crystal Report Sum of a Group Summary
I need to include a summary to the group footer of the formula written. Any assistance will be appreciated.
Try this:
Create a formula Initialize and place in report header
Shared Numbervar counter;
counter:=0;
Change your existing formula like below:
Shared Numbervar counter;
Local Numbervar display;
IF ({HISTOPAYE.RUB_0} = "SALACT_MTD") AND {HISTOPAYE.TYP_0} = 6 AND {HISTOPAYE.BUL_0} = Maximum({HISTOPAYE.BUL_0}, {HISTOPAYE.EMP_0})
THEN display:={HISTOPAYE.AMT_0}
ELSE 0;
counter:=counter+display;
display
Now create below formula in group footer
Shared Numbervar counter;
counter; //This will give the final output sum of all values
How do I add a running total or summary field on a formula field in crystal reports?
// Sample Report
Serial No. Premium Commission Net (Premium-Commission)
-----------------------------------------------------------------------------
1. 10 4 6
2. 40 30 10
---------------------------------------------------------------------------
Grand Total 50 34 16
In sample report, Net (Premium-Commission) is a formula field which gets evaluated for each row? How do I add a grand total/summary field for my formula? It seems we can add a summary field to only Command fields.
Suppose Net (Premium-Commission) formula field name is {#Net}. Now you have to create another three formula fields.
Initializer: this formula filed will be placed in header section to reset all variables.
Increment: this formula field will be placed in detail section to summarize the value.
Total: this formula field will be placed in footer section to show total of {#Net}.
Code will be writen in formula fields as below.
{#Initializer}
WhilePrintingRecords;
Numbervar dSum :=0;
{#Increment}
WhilePrintingRecords;
Numbervar dSum; //Don't initialize zero
dSum:=dSum+{#Net}; //{#Net} formula field must be return numeric value
{#Total}
WhilePrintingRecords;
Numbervar dSum; //Don't initialize zero
dSum;
Place all formula fields in their appropriate section and suppress {#Initializer} and {#Increment} formula field.
If you are using any calculation then that is not possible but one workaround would be to sum the each row and reset it in header.
Create a formula #Intialize in that write below code:
Shared NumberVar count;
count:=0
In detail write below formula and place it after Net (Premium-Commission).
Shared NumberVar count;
Count:=count+<>
\
3. Now create one more formula #Display and place it in footer.
Shared NumberVar count;
count;
I have a report within Crystal 2008 that has 2 subreports, each of which is a Crosstab. I have split them into different reports as their selection and database queries are unrelated.
What i need to be able to to is to create a variable for each of the Column Totals and be able to pass this onto a third report for each of the two cross Tabs.
The Layout of each cross tab is formatted the same, with the columns being the PO Number and the rows being charges against each PO. It is the total of the columns that I need to perform a further calculation on.
Total of Crosstab1 Column1 - Total of Crosstab2 Column1 for each column that is displayed by the selection query to give me a difference between the two crosstabs.
I have tried using the CurrentFieldValue but this only appears to set the total of the very last record to the variable.
I hope that there is a way to do this and that i have provided enough information for you to be able to assist me.
I think its hard to get the value from crosstab but one workaround would be.
Create a shared variable in both subreports and assign the summary value to the shared variable.
Suppose cross tab is showing employee salary sum then in the formula assign the value to the shared variable as
Shared Numbervar report1;
report1:=Sum(employee.salary)
similarly do in the second subreport aswell.
Now in main report create a formula
Shared NumberVar report1;
Shared NumberVar report2;
report1+report2;
let me know how it goes.
I have the following formula: #Sales_Cost
(Sum({Estimate_Retail_Inventory_Change___Detail.Sales_Ret_Final_Amount}, {Estimate_Retail_Inventory_Change___Detail.Inv ID}) -
(Sum ({Estimate_Retail_Inventory_Change___Detail.Sales_Ret_Final_Amount}, {Estimate_Retail_Inventory_Change___Detail.Inv ID}) *
{#GM%_For_Cost_Sales}))
This produces the following results and I have placed in my GH2 section:
592.77
1038.26
2628.38
3598.62
356.58
I want to total those values for my Report Footer, but I get the error message, "This field cannot be summarized".
How do I do this?
You need to create a manual running total. To do this you will create 3 new formula fields.
The first one goes in the report header to initialize the running total variable.
WhilePrintingRecords;
NumberVar manualTotal :=0;
The second one goes in the group header with your summary formula.
WhilePrintingRecords;
NumberVar manualTotal := manualTotal + {#Sales_Cost};
The third one goes in your report footer to display the calculated value.
WhilePrintingRecords;
NumberVar manualTotal;
manualTotal;;
Assuming {#GM%_For_Cost_Sales} will not vary within each Inv Id value (though it could vary across different values) and that the group for GH2 is on Inv Id, the simplest way to do this would be to change your formula item to:
{Estimate_Retail_Inventory_Change___Detail.Sales_Ret_Final_Amount} *
(1 - {#GM%_For_Cost_Sales})
- and place summed #Sales_Cost fields into both your GH2 group header and report footer sections.