Difference between First and last record

Could any one tell me how to find the difference between first and last record in crystal reports
LVL 5
P_RamprathapAsked:
Who is Participating?
 
mlmccCommented:
You can add a "second" report header section (if that is what you mean) by right clicking the report header in the left margin and clicking INSERT SECTION BELOW

mlmcc
0
 
analliahCommented:
what is the field type
0
 
mlmccCommented:
I assume you mean the difference between the value of a field in the first record and the same field in the last record.

Try this idea.  I assume it is a numeric field?
In the report header add a formula
Name - GetFirstValue
WhilePrintingRecords;
GLobal NumberVar FirstRecordValue := {YourFIeld};

In the report footer
WhilePrintingRecords;
GLobal NumberVar FirstRecordValue;
FirstRecordValue - {YourFIeld}

mlmcc
0
Cloud Class® Course: Microsoft Azure 2017

Azure has a changed a lot since it was originally introduce by adding new services and features. Do you know everything you need to about Azure? This course will teach you about the Azure App Service, monitoring and application insights, DevOps, and Team Services.

 
mlmccCommented:
If you mean between the whole records then you would need to use a variable for each field and do the appropriate comparison in the report footer

mlmcc
0
 
P_RamprathapAuthor Commented:
Hi mlmcc

 iam new to crystal reports , i got what your saying , but the think is how to i add a formula field in Header and footer , do we have formula field seprate for Header and footer , if so , could you please tell me how to do it .
0
 
analliahCommented:
Formulas are created the smae way regadless where they are being used.

just create 2 formula, first
Name - GetFirstValue
WhilePrintingRecords;
GLobal NumberVar FirstRecordValue := {YourFIeld};
 then
 second
WhilePrintingRecords;
GLobal NumberVar FirstRecordValue;
FirstRecordValue - {YourFIeld}


Now just drag your first formula and drop it in the header and the second formula in the footer...

How to create a formula?
 on your report field, left or right depends.. you should see formula in the tree...right click and choose new formula
0
 
P_RamprathapAuthor Commented:
Do you mean , i drag the formula field into Header and hide it if i dont require to show it right ? am i correct
0
 
analliahCommented:
Yes
0
 
P_RamprathapAuthor Commented:
Great , it worked thanks a lot
0
 
P_RamprathapAuthor Commented:
How do i do the same if i nee to insert the section 2 into page header ?
0
 
analliahCommented:
could you explain more about your situation.
0
 
analliahCommented:
If you have a screen shot of your design view that would be great. or just attach your report and change the extension to .doc
0
 
P_RamprathapAuthor Commented:
Thanks a lot , it worked
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.