How to tell the order of execution of formulas in the details section of Crystal Reports - crystal-reports

I was working on a report that had multiple formulas that used the same variable. All the formulas were used in the details section of the report. I noticed that the order the formulas were executing cause an incorrect total. I fixed this by using the ExecuteAfter() function. But it made me curious what rules Crystal uses to decide when to execute a formula.
I found this website http://book.soundonair.ru/sams/ch04lev1sec6.html which was quite informative, however as best as I can tell, all of the formulas of my report are executed in the Evaluates recurring formulas stage of Crystal Reports Processing EnginePass #1. I want to know within that stage, how Crystal decides to execute.
To try to make the question clearer:
If I have formula 1, formula 2 and formula 3. Formula A sets variable A to be a database value. Formula 2 sets Variable B to a value. Formula 3 sets variable C to A + B. All are in the details section of the report. How does Crystal decide which order to execute them in? Obviously I want Formula 3 to executer after formula 1 and formula 2.

Related

Crystal Report - This field can't be summarized

I have a formula ABC
sum({Table1.col1},{Table2.FieldName})
My report is grouped by Table2.FieldName.
Then then want to add the value of ABC to another column's value.
My formula :
sum({#ABC},{Table2.Col1})
Here, I am getting this error that #ABC cant be summarized.
Is their any workaround to add these fields.
Crystal can't total other totals.
If you explain the situation in more details, there may be another way to accumulate the desired total.
Alternatively, Ken Hamady maintains a list of 3rd-party Crystal Reports UFLs (User Function Libraries) here. At least one of them allows you to do totals of totals by providing functions that allow Crystal formulas to accumulate and retrieve total values in memory.

Crystal Reports 11: Finding where data is being filtered out

I am not a Crystal Reports developer.
In a legacy Crystal Report, I have been asked to find out why some Rows of data are being excluded from the Report Output at run time.
I copied the SQL behind the report and when I ran it in SQL Server Management Studio, those rows are not excluded. This is what leads me to conclude that there is a filter in the report itself that is excluding certain rows.
My question:
What are the different places in Crystal Reports 11 that I should look to find if any filtering is going on at run time?
I have looked at Formula fields, Selection formulas, Parameter Fields ... but though I have seen various code in those places, I have not found anything that looks like it will limit the output.
I would appreciate any pointers/suggestions.
Besides section suppression, look at:
Report, Selection Formula, Record...
Report, Selection Formula, Group...
Database joins
If the report SQL is the same as the one you checked in SSMS (including record selection formula , which will be the WHERE clause) , check report's details section suppression formula. A details row might be suppressed based on some row values

crystal report problem

what is the equivalant command like in vb for EOF(), MoveNext, Moveprevious commands in crystal reports
There are no equivalent answers in Crystal Reports, at least not in the versions I have used. Crystal Reports more or less simply dumps the data out into the report.
That said, if you are in a detail row, and you want to find out what the next value of a field will be, you can use:
next({YourColumn})
You can also find out the previous column value by using this:
previous({YourColumn})
Keep in mind that Next() won't work on the last record, and Previous() won't work on the first record.
I'll have to double-check, but I believe there is an OnLastRecord function that returns TRUE if you are on the last record.
First, welcome to SO!
Second, you sound new to Crystal Report's purpose is to display data, not perform the kind of calculations you're talking about. CR usually goes record-by-record through the data, displaying (or suppressing) each record, and adding group headers & footers.
To answer your question, LittleBobbyTables does give a few good pointers. To see the entire list of functions available to you, there is a list in the Formula Editor (see pic below). Press F1 for detailed descriptions of each command.
You can also:
Create a "Running Total Formula" that will evaluate each record and give a calculation in the group footer.
Do the calculations outside of Crystal Reports and only feed the end result in (perhaps with an unlinked join to your primary table).
The most complex option is to make a subreport that does the calculation and feeds the result back to the main report
Can you give us some more details about what you're trying to do?

Crystal Report-Running Total

I have a problem with running Total in Crsystal report9
if their is no values available for a Paticular field how can we return the running total as '0'
Instead of display the Running Total directly in your report create a Formula Field based on the Running Total and drag it into the report.
Your formula should look like this (Crystal Syntax)...
if ISNULL({#RunningTotalField}) then
"0.00"
else
ToText(RunningTotalField, 2)
If there is no data for that particular group, then Crystal won't show it easily. Your options are :
1) Use subreports to display the values for a particular group, and keep the main report just looking at the table(s) containing the group headers.
2) Use a stored procedure as the source so you have full control over the SQL that is run.
The problem is that as soon as you use a field to group, Crystal will only return records where that field has been used. If it was simply in the Details section you could modify the link to a LEFT JOIN and it wouldn't matter, but the group forces the INNER JOIN which means the groups without data are not returned.
Unfortunately Running Totals don't show up if there are no records that match your criteria. An alternative is to use a set of formulas calculated in various sections of the report. The technique is widely described in the Crystal literature. For example, this TekTips gives a very succinct overview of your options.
You set up an initialising formula in each header, with the evaluation time directive "WhilePrintingRecords". This approach was the only one available for doing running totals in the "good ol' days" before RunningTotal objects were available.

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});