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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Define the last record

Status
Not open for further replies.

Strannik

Programmer
Jul 4, 2002
132
UA
Hi,All!

I'm not a rookie in CR, but I'm starting new project which requires more data formatting ...

How to define in formula whether current record is last on the current page or not ?I need to display bottom border for the last record only.

Thanks in advance!
 
Why not just place your formatting in the page footer?

Anyway, it would depend on whether you have new page after turned on, whether there are groups, and other factors.

Crystal doesn't have a lastrecordonpage function, so you'll have to derive this in some way, which since you've shared nothing about your data or layout, I can only guess.

If it's grouped and a new page after is on the group, just check that the current group <> the next group using:

{table.groupfield} <> next({table.groupfield})

Otherwise share some information about your data, groupings and whether you force new pages or let Crystal decide.

-k
 
Thanks, synapsevampire!

I've returned to that problem with no success. All i have is stored procedure which returns recordset. One details section, no grouping so reports seems simple but how to display bottom border ?

I read carefully your post but nothing helped me.

1)How to proceed formatting in the page footer ? Data just duplicate ... that's not I'm searching for ...

2)Next and PageNumber functions are very helpful but how to investigate whether next record is on new page ?

Thanks one more.
 
There are three methods you can use. To place a line at the bottom of each page, go to insert->line and draw a line across the bottom of the page footer.

If you need to place conditions on its appearance, then select insert text box, and place it in the page footer, stretch it to fit the width of the page, then select the text box, right click on it, select change border and select a single line for &quot;top.&quot; Add any conditional criteria by clicking on E2 and creating a formula.

If you want the line to fall exactly at the end of the last record on the last page, not on the bottom, then put the text box in the details section, stretching it around all fields. Select the type of line for &quot;bottom&quot; and then click on E2 and enter a formula:

if onlastrecord or
recordnumber = 25 then crSingleLine else crNoLine

This assumes you have 25 records per page, so change the 25 to reflect the actual number. You can insert {recordnumber} from the field explorer->special fields into the details field just to see. It appears that this will work since you won't have any group headers or footers which could change the number of records per page.

If you are suppressing any records or doing a record select you would need to substitute a running total for {recordnumber} in the formula, where the running total counts an ID field that appears in every record, evaluate based on a formula that excludes those records that you are already excluding through suppressions or a group select, and reset never.

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top