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

Compare resultant Date Time in subreport to UpDtTm column in main rpt 1

Status
Not open for further replies.

diane55

Programmer
Dec 14, 2004
20
0
0
US
First, thanks for taking time to read my post. I am not sure I have provided enough detail so let me know...
I need to compare DateTime result in SubReport to Date Time in Main Rpt.

I am using CR Dev. 10
Oracle Database

I need to take the resultant Max Date from the subreport and compare that date to the update date and time column in the main rpt.

I need to keep the largest record. (using the time stamp) There are currently multiple records on the same date.

How can I write the formula to suppress the earlier date time if the datetime returning from the subreport is greater?

Thanks Diana
 
I will assume that you are looking for the maximum of some group, and that the sub is linked by the group field and placed in the group header.

In the sub, place a formula like the following in the report footer:

whileprintingrecords;
shared numbervar maxdt:= maximum({table.datetime});

In the main report, go to the section expert->details->suppress->x+2 and enter:

whileprintingrecords;
shared numbervar maxdt;
{table.datetime} < maxdt

-LB
 
The {Table.DateTime} is of the type DateTime so in using a numbervar dec - I get a message that I need a number.

I tried to wrap toNumber but now I get a string msg -
shared numbervar maxdt := toNumber(maximum({table.dateTime}))

I believe I am missing part of the formula construction.
 
So sorry. That should have been:

In the sub, place a formula like the following in the report footer:

whileprintingrecords;
shared datetimevar maxdt:= maximum({table.datetime});

In the main report, go to the section expert->details->suppress->x+2 and enter:

whileprintingrecords;
shared datetimevar maxdt;
{table.datetime} < maxdt

-LB
 
Thanks LBass -
You helped me solve the reporting issue for the max function - Kudos to you!

I do have one more question -
I had to place my sub in details a in order to get my fetch in details b to work
The problem is now - I can not supress details a or i lose all of the detail b records - I can not hide the details a without hiding B
I have minimized the font size to 1 on details a, but the sub is still showing the small font
Any ideas on how to hide the sub and not hide the records in details b?
 
No, you don't have to minimize it. Suppress all sections WITHIN the subreport, format the subreport->subreport tab->check "suppress blank subreport", and also go into the section expert of the main report->detail_a->check "suppress blank section". Do NOT suppress the subreport object or the section it is in.

-LB
 
ok LB
You have done it again! I had to re-do my set-ups twice to get CR to save it. Weird.

A final tweek -
I also pulled your thread on counters, as I need to set them up also. I have the inits, accums and show formulas in place.

However, I can't seem to get the counter to not increment the counter when processing a supressed record.

Any thoughts on where to be begin to get around incrementing counters based on suppressed records.
 
Hmm, I'm not sure what thread you are referring to, but if records are suppressed you have to explicitly exclude them in the formula based on the suppression criteria. If a record is suppressed when {table.field1} = "A", then the counter formula would be set up like:

whileprintingrecords;
numbervar cnt;
if {table.field} <> "A" then
cnt := cnt + 1;

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top