Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

First and last record values

Status
Not open for further replies.

bond24

Programmer
Joined
Jan 9, 2008
Messages
24
Location
US
HI,

I have the following data in the column,
12
13
14
11
34
10
may i know how to get the first record value(12) and last record value(10)

Thanks n advance
 
Create a group based on the field and place the field in both the header and footer and it will show each value.

If this is not what you are after then please post back , this time including:

Crystal version
Current Layout
Requierd results

Thanks.

'J

CR8.5 / CRXI - Discovering the impossible
 
Also could I ask, what is the current sort order?

CR8.5 / CRXI - Discovering the impossible
 
I m using Crystal Report 8.5.I m doing any group on another column Y(which is date). i m not doin any sorting.
so my issue is i have a column called 'X' which have values as given below

X
----
12
13
14
11
34
10
i want to Subtract first value(12) from last value(10).
for example in the above
first value - 12
last value - 10
so i have to do this caluclation 10-12=-2

i hope i made it clear.

Thanks for the reply
 
Is your sample of detail level data or is it a group summary? If it is detail level, then you need to tell us what determines the order WITHIN the date group.

If detail level, you could use a formula like the following in the detail section (although the results would change if you add a sort field):

whileprintingrecords;
numbervar max;
numbervar min;
if onfirstrecord or
{table.date} <> previous({table.date}) then
min := {table.amount};
if onlastrecord or
{table.date} <> next({table.date}) then
max := {table.amt};

In the group header use a reset formula:

whileprintingrecords;
numbervar max;
numbervar min;
if not inrepeatedgroupheader then (
max := 0;
min := 0
);

Then in the group footer for date use:

whileprintingrecords;
numbervar max;
numbervar min;
max-min

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top