on ‎2014 Apr 02 9:37 AM
Hi All, I am trying to figured out the difference between while reading records and whileprintingrecords.
I created two formulas for running totals like this.Both are giving same result.
WhileReadingRecords;
numbervar x:=x+1;
WhileprintingRecords;
numbervar x:=x+1;
Please suggest what is the difference
Request clarification before answering.
Hi Divya,
Before getting into the details about formulae that contain 'whileprintingrecords' and 'whilereadingrecords', I would suggest that you should try to understand CR's 'multi-pass' engine.
Both the formulae you posted above will 'execute at different times' in the report's lifecycle. The first will execute when the records are being read from the database and hence numbers each record one by one (due to x := x + 1).
The second one executes 'after' the above stage completes evaluation.
The only time you'll really see a difference in results from the above formulae is when you add a group and then do a Top N sort or add a Group Selection formula.
P.S: Please do read the CR User Guide too if trying to understand the fundamentals.
-Abhilash
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Abhilash,
Can you please explain this with one example.
The only time you'll really see a difference in results from the above formula is when you add a group and then do a Top N sort or add a Group Selection formula.
Dear Abhilash sir,
I have a doubt in crystal report. I got the formula for superscript and subscript from you itself in the earlier stage. Now my problem is its not refreshing (not clearing or reassigning). if first time whats the formula value appearing the same is repeating all the fields.
the first image is the entry form, in Gen Limit, three lines in the grid, with values (i with Superscript and other one is normal)
in my second image is the SAP crystal report, with the entered values..but in all the lines the first value is repeating. I used 'WhilePrintingRecords' after searching from google..but its not clearing the variable. Please help..
in my report formula, i used these in starting :
stringvar s;
WhilePrintingRecords;
s:= {TMPMASREP.FL13};//getting the input value from this field to variable s
stringvar subS:= '<sub>'; // beginning of a subscript
stringvar subE:= '</sub>'; // end of a subscript
stringvar supS:= '<sup>'; // beginning of a superscript
stringvar supE:= '</sup>'; // end of a superscript
etc..coding


Regards,
Sajeesh
Forces the program to evaluate the formula while it is reading database record data.
If you try to include a group in this formula, you will get an error message.
Forces the program to evaluate the formula while it is printing database record data.
You are using a simple numbervar x,so it will not matter in this formula.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Divya,
To understand better, go in crystal help and read Crystal Reports Pass overview.
Whilereadingrecords;
These formulas are those that contain database
fields but do not contain references to subtotals or summary information. This
evaluation time is known as "WhileReadingRecords."
"WhilePrinting Records."
These are formulas that contain references to subtotals or summary
information, also known as "PrintTime" formulas. This evaluation time is known
as "WhilePrinting Records."
In your case you are not referring any database fields. Try this example with database fields and summaries.
-Sastry
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
you would not notice any difference in such a formula, since the variable x is simply incremented and it does not matter which pass is being used.
however, if you prefix a running total evaluation-formula (that typically sums up cumulative group summaries) with whilereadingrecords, it will show 'this formula needs to be evaluated at a later pass' error. It will need a whileprintingrecords since the group-summaries are calculated in pass-1 whereas whilereadingrecords is executed in pre-pass 1.
I am guessing that you are preparing for an interview, is it the case?
If yes, then please use the learning resources avaialble at the left-hand side menu.
If no, then please post the issue that you're facing in the report with snapshots.
-Prathamesh
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
| User | Count |
|---|---|
| 15 | |
| 9 | |
| 6 | |
| 4 | |
| 4 | |
| 4 | |
| 3 | |
| 2 | |
| 2 | |
| 2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.