Home
Crystal Reports Training
Crystal Reports XI
Crystal Reports .NET
Crystal Reports Forum
News
Tech Support
Active Topics
Memberlist
Search
Help
Register
Login
Report Design
Crystal Reports Forum
:
Crystal Reports 9 through 2022
:
Report Design
Topic: formula field is zero in the first group record
Author
Message
Macavity
Groupie
Joined: 24 Sep 2012
Online Status: Offline
Posts: 93
Topic: formula field is zero in the first group record
Posted: 14 Feb 2013 at 11:00am
Hello,
I have a formula field on a group header which does a datediff.
Both dates are on the report and the datediff is fine for all records, exept for the first record, the field is zero instead of 25.
have tried whileprintingrecords; and onfirstrecord; in the formula, but it doesn't solve the problem.
Any ideas ?
thanks
IP Logged
DBlank
Moderator
Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Posted: 14 Feb 2013 at 11:17am
what is the formula?
IP Logged
Macavity
Groupie
Joined: 24 Sep 2012
Online Status: Offline
Posts: 93
Posted: 15 Feb 2013 at 3:52am
onfirstrecord;
whileprintingrecords;
local datetimevar d1:= {startdate}
local datetimevar d2:= {enddate}
datediff("D", d2, d1)
result :
startdate enddate diff
2012-12-08 2013-01-02 0
2012-12-08 2013-01-02 25
2012-12-09 2013-01-02 24
2012-12-23 2013-01-08 16
IP Logged
DBlank
Moderator
Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Posted: 15 Feb 2013 at 7:12am
the on firstrecord is not needed. it only references the first record in the report, not the group.
You should just be able to use the below and place in the group header to display the rsult of the first row.
datediff("d", {startdate}, {enddate})
IP Logged
Macavity
Groupie
Joined: 24 Sep 2012
Online Status: Offline
Posts: 93
Posted: 07 Mar 2013 at 11:49am
I finally found the real problem.
The start date is a variable passed on from a subreport.
The subreport was in the same section as the rest of the fields.
I inserted a section on the GH. Copied all the fields into GHb and left the subreport on GHa.
problem solved !
IP Logged
Printable version
Forum Jump
-- Select Forum --
Announcements
Talk with the Author
Self-Publishing
Job Postings
New feature request
Report Design
Data Connectivity
Technical Questions
Tips and Tricks
Crystal Xcelsius
Report Design
Data Connectivity
Writing Code
Tips and Tricks
Report Design
Data Connectivity
Writing Code
Tips and Tricks
You
cannot
post new topics in this forum
You
cannot
reply to topics in this forum
You
cannot
delete your posts in this forum
You
cannot
edit your posts in this forum
You
cannot
create polls in this forum
You
cannot
vote in polls in this forum
HOME
|
FREE EBOOK
|
PROGRAMMING GUIDE
|
PURCHASE
|
REVIEWS
|
CONTACT ME
|
FAQ
|
LINKS
|
PRIVACY
|
CLICK PLAYS
|
KONACAD
© 2004-2026 Brian Bischof. All Rights Reserved.