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!

Trying to share a datetimevar between the subreport and main report

Status
Not open for further replies.

LMGroup

MIS
Apr 10, 2006
85
CA
I'm using CR 2008 v12.2.0.290 with a MS SQL Server db. I'm trying to create what should be a very simple report. I'm selecting all the open (uninvoiced) jobs and I want to know the difference in the number of days between when it finished costing and when it made it to invoicing.

The main report has the job number (selected using the criteria: open and contains the "costing done" status) and 2 subreports. The first subreport gets the datetime value of the "costing done" status and the 2nd gets the datetime value of the "in invoicing" status (if it exists).

In the invoicing subreport, I have the following formula field:
Code:
shared datetimevar invoiced;

invoiced:={JobStatus1.Date};
invoiced;
This one works. The correct date from the subreport appears in the main report.

In the main report, I created 2 formula fields:
Code:
shared datetimevar invoiced;

invoiced;
This was just to check if the sharing was working, which it is not. It doesn't show up in that record's detail line. It appears in the following record and all subsequent ones until a new invoiced value is found. That one shows up on the following record, etc.

The second formula is:
Code:
shared datetimevar invoiced;

invoiced:=CDateTime (1900, 01, 01, 00, 00, 00);
I was trying to reset the value. Again, this "sort of" works but not as I expected.

I'm not sure if my code is wrong or my placement of the formulae are wrong.

I was looking for:

Job # Costing Date Invoice Date Date Difference

Thanks for any help.
 
Thanks, anyway. I figured it out.

I had to add a detail section before and after my main detail section so that I could get the shared value and then reset it. It's a rather messy solution, but it works.

If you have a cleaner way of doing this, I'd love to hear it.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top