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

Report - Print when condition is met (finding the next date)

Status
Not open for further replies.

keepingbusy

Programmer
Apr 9, 2000
1,470
GB
Hi

I have a table, part of which contains 16 date fields used for Due visits and Date visit complete. An example of the table names are FADATE01, FADATE01PR etc. These are used to record the actual date a visit is due and other fields such as FADATE01PR, FADATE02PR etc are used when the visit is actually made.

When visits are completed, it allows a report to be created showing date of visits and actual visit. This isn’t a problem as the fields are shown on a report using:
Code:
NOT EMPTY(FADATE01) AND FADATE01<mdatefrom AND NOT EMPTY(FADATE01PR)

I have been racking my brains for a few days on the problem I’m trying to resolve and that is I need to add another column on the report that shows the next date due.

Here is a scenario:

FADATE01 could be 01/03/2007 and FADATE01PR could be 18/03/2007

The next due date could be contained in FADATE02 but if my condition is showing FADATE03 then the next would be FADATE04 or if FADTE04 was showing it would revert back to FADATE01

How do I find out which field meets the condition so I can add the next one to the report?

Hope that makes sense guys and thanks in anticipation.

Version used VFP6 and mdatefrom=DATE()


Lee

Windows XP
Visual FoxPro Version 6 & 9
 
I would place all the fields that need to be printed on the form and if only 1 of 3 field could print at one time I would place them all on the exact same place on the form.

In all 3 fields, That print in the same place, Propertys tab "Print When"
On the Print when line you can do
IIF(!EMPTY(date1),date1,IIF(!EMPTY(date2),date2,IIF(........))))
 

DWGrewe

Tried this line:
Code:
IIF(!EMPTY(fadate01),fadate01,IIF(!EMPTY(fadate02),fadate02,IIF(!EMPTY(fadate03),fadate03,IIF(!EMPTY(fadate04),fadate04))))
and I'm getting an error message "Missing comma (,)"

I'm sure this must be a typo somewhere.

Lee
 
Lee

I may be wrong, but Immediately after the final'fadate04' I think there should be a comma plus whatever you wish to print if fadate04 IS empty. Nested IIFs always give me trouble too, but it's all part of the fun isn't it!

Roger
 
All,

I was able to resolve this issue by adding two new date fields to a form. This gave us a date from and date to and also advance dates from and two. This in turn allowed us to set a condition which was placed in the Print When of the report:
Code:
not empty(FADATE01) and empty(FADATE01PR) and between(FADATE01,mnextfrom,mnextto)
As DWGrewe suggested, all the relevant fields were added to the report and the subsequent Print When commands were changed accordingly e.g.
Code:
not empty(FADATE02) and empty(FADATE02PR) and between(FADATE02,mnextfrom,mnextto)
not empty(FADATE03) and empty(FADATE03PR) and between(FADATE03,mnextfrom,mnextto)
etc...

Thanks to all on this post for the suggestions (and inspiration!)

Lee

Windows XP
Visual FoxPro Version 6 & 9
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top