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

Main report reflects wrong shared value on some lines

Status
Not open for further replies.

modglin

Programmer
Apr 10, 2001
105
I have a report that is using a table that contains classes taken by the employees and then a subreport in that report that uses a table that has certification that the employees have.
On the subreport - I have the expiration date of the employee certifications. On the detail line I have a formula
Code:
\\@sharedExpDate
Whileprintingrecords;
Shared datevar SharedExp:= {empcert.expdate};
On the main report I created a formula in the group footer 3(emp name)
Code:
\\@sharedExpirationDate
Whileprintingrecords;
Shared datevar SharedExp
I also have a formula in the detail line of the main report
Code:
\\@Expired Date
Evaluationafter({@sharedExpiredDate})
datevar Expired:= {@sharedExpireDate};

The reports are linked by Emp Number.

When I run the report the first line of detail does not show an expiration date. The next few lines are fine. When the next employee starts - it contains the date from the previous employee on the top line and then the remaining lines have the correct expiration date for the employee.
Do I have the formulas in the correct sections?
example of how it is showing on the report
Employee Cert Exp Date Class
Tom (blank) Company Goals
Tom 7/5/2009 People Skills 101
Tom 7/5/2009 People Skills 201
Tom 7/5/2009 Hiring & Interviewing

Larry 7/5/2009 Company Goals
Larry 8/15/2008 People Skills 101
Larry 8/15/2008 Hiring & Interviewing

Jane 8/15/2008 Company Goals
Jane 2/1/2009 People Skills 101
Jane 2/1/2009 People Skills 201
etc.

 
What you should have posted is where the subreport is.

Hopefully this will resolve, as where things are placed is probably your problem.

Right click the group header and select insert section below.

Place this in the group header 1:

\\@sharedExpDate
Whileprintingrecords;
Shared datevar SharedExp:= 0

Place your subreport in the group header B, and use your formula within the subreport:

\\@sharedExpDate
Whileprintingrecords;
Shared datevar SharedExp:= {empcert.expdate};

Now you can reference the formula in the details:

\\@sharedExpDate
Whileprintingrecords;
Shared datevar SharedExp

I should also state that you probably don't need a subreport. In the future you might consider posting technical information and requesting assistance with design rather than designating architecture until you become familiar with Crystal.

For architectural assitance, or optimizing designs in future posts, please include:

Crystal version
Database/connectivity used
Example data
Expected output

-k
 
Sorry, the first group header formula should be:

Place this in the group header 1:

\\@sharedExpDate
Whileprintingrecords;
Shared datevar SharedExp:= cdate(1970,1,1)

Overlooked the date part...

<sheepish grin>

Then the details might use:

\\@sharedExpDate
Whileprintingrecords;
Shared datevar SharedExp;
If SharedExp <> cdate(1970,1,1) then
totext(SharedExp)
else
"N/A"

-k
 
synapsevampire - I knew I would forget something in the post!
The sub is actually on the detail line rather than in the header.
I'm thinking that is actually part of my problem (everything else that I have done with shared variables were in the groups instead)
If need be I can create another sub report to put in the header to get it to work.
I'll try what you posted and see if that works with the sub in the detail line.
 
synapsevampire - finally getting a chance to let you know -
The user actually liked the report with the subreport moved to the group rather than on the detail line (Different day, different preference on layout for the user)
Anyway, with the formulas that you provided and moving the subreport to the group that worked.
Appareciate the help.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top