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

Display text for Null Date Value

Status
Not open for further replies.

wld1957

Technical User
Feb 3, 2006
68
US
CRXI - I have created a text box with background text. In with the background text are a few date values. In one (1) of the values I have been trying to have it display text if the field is left empty. This will remind them to put the date in the field. The field is a date field. I have tried the following: The field is formatted in the prefix of the customize tab as follows: If if put isnull it only shows the date, if I change it to not is null then it shows only the text. I have been unable to get them both to show based on the field being null.

if IsNull({cpmain.dtudftext2}) then "NEED 1ST SALE DATE ON PAGE 3"
else

if remainder(day({cpmain.dtudftext2}),10) = 1 and
day({cpmain.dtudftext2}) <> 11 then
totext({cpmain.dtudftext2},"d")+"st "+ "day of " +
totext({cpmain.dtudftext2}, "MMMM "+" yyyy,") else

if remainder(day({cpmain.dtudftext2}),10) = 2 and
day({cpmain.dtudftext2}) <> 12 then
totext({cpmain.dtudftext2},"d")+"nd "+ "day of " +
totext({cpmain.dtudftext2}, "MMMM "+" yyyy,") else

if remainder(day({cpmain.dtudftext2}),10) = 3 and
day({cpmain.dtudftext2}) <> 13 then
totext({cpmain.dtudftext2},"d")+"rd "+ "day of " +
totext({cpmain.dtudftext2}, "MMMM "+" yyyy,") else

totext({cpmain.dtudftext2},"d")+"th "+ "day of " +
totext({cpmain.dtudftext2}, "MMMM "+" yyyy,")

I also tried to create a formula but that did not work also.
The formula is:
if not isnull({cpmain.dtudftext2}) then "Need 1st Sale Date On Page 3" else totext({cpmain.dtudftext2})

This field is in the report footer of the report. This should be easy but is not working out. Any help would be greatly appeciated. If I do not put something to remind them to put the dates in they will leave them out.

Bill
 
did not work
That's not an easy description to work from.

You treat {cpmain.dtudftext2} as a date - is it? In Crystal 10, you can find out from the Field Explorer, if you right-click on a field and select Show Field Type, if it isn't on already. cdate will convert a date in string format to a real date.

The second formula is the wrong way round. Make it
Code:
if  isnull({cpmain.dtudftext2}) 
then "Need 1st Sale Date On Page 3" 
else totext({cpmain.dtudftext2})

For the first formula, I'd expect if remainder(day({cpmain.dtudftext2}),10) = 1 to get 1.1 for 11. Better to use something like
Code:
If Datepart("d", {your.date}) in [1, 11, 21, 31] then "st"
Continue like that, in a separate formula field.

Display to check it is OK, before trying to stitch things together.

[yinyang] Madawc Williams (East Anglia, UK). Using Windows XP & Crystal 10 [yinyang]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top