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!

shared variables and comparing dates 1

Status
Not open for further replies.

jchewsmith

Technical User
Nov 20, 2006
161
US
I have a report with a subreport that I want to see if the datetime field called estimated date = the datetime field in the main report call estimated date.

I need to convert these fields to not be date time because I only want to compare if the dates are the same not the datetime.

I currently have a formula to share the variable after I change the datetime totext(estimated date, "MM/dd/yyyy") but that is not working. I appear to get the result of 09/27/2019 on both the subreport and main report but when I try to create a formula to highlight if they match it does not highlight.



 
Set up the variable as a shared datevar. Wrap each of the estimated datetimes in date(), e.g.,

Shared datevar estate := date(estimateddate);

Etc. The date format is irrelevant.

-LB
 
This works and I am getting the date in both the subreport and main report, but I am trying to highlight the field if they don't match. I have a different string field that works perfectly but the date field is not working.

This is the formula I am using for the string field and it works if the field are different
if {@Loan Officer} <> {Agents.sEmployeeLoanRepName} then cryellow
else crwhite

This is the formula i am using for the date field and it highlights everything matching or not?
if {@DateEstCloseD} <> {@EstCloseDate} then cryellow
else crwhite

 
You need to show us the content of your formulas and of any nested formulas.

-LB
 
Subreport formula - in the report footer of subreport
WhilePrintingRecords;
Shared DateVar L2EstCloseDate := Date({Status.sEstCloseD});

Main report formula - in a detail section below the section that the subreport is in
WhilePrintingRecords;
Shared DateVar L2EstCloseDate;
L2EstCloseDate


This is just a formula to change the field in the main report to a date instead of a datetime
@DateEstCloseD:
Date({Status.sEstCloseD})


 
Place each date formula in the detail section to see what the values are. Then report back with the results.

In what section is the subreport placed? Is it linked to the main report? If so, on what value?

This is a little hard to troubleshoot without seeing specifics.

-LB
 
I figured it out when you asked the question of where the subreport was placed. I had the comparison in a detail section that was above the subreport, when I moved it below it worked perfectly.
THANK YOU!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top