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!

covert text to date 2

Status
Not open for further replies.

sap1958

Technical User
Oct 22, 2009
138
US
In our database the birthmonth, birthday and birthyear are formatted as text. I concatenated the three as follows:
date((val ({corebrthyr})),
(val ({corebrthmn})), (val corebrthdy})))and called it @birthday.
It formats and provides me a birthday format. Now I want to add in a filter that will display the report only if the birth month falls within the current month. I created a formula called @month. Formula is month(currentdate). Here is the comparison:
if @month = @birthday then true else false. I want to put this as a booleon in the record select. However I keep getting a message " A day number must be between 1 and the number of days in the month" It appears there is a problem with the formula called @birthday. Any thoughts and solutions
 
Hi, when you displayed the @birthday formula to see what actually displays, were any birthdays incorrect ( like more days than in a month?)? Also, it looks like some extra parens are in there try:
Code:
date
(
val({corebrthyr}) ,val({corebrthmn}), val(corebrthdy})
)

Also be sure the year is 4 digits.

Did you try, for the boolean,
Code:
If @month = Month(@birthday)
then
True
Else
False



[profile]

To Paraphrase:"The Help you get is proportional to the Help you give.."
 
You might want to check for nulls in the day field, as in:

//{@day}:
if isnull({corebrthdy}) or
trim({corebrthdy}) = "" then
1 else
val({corebrthdy})

Then use that in {@birthday}:

date(val({corebrthyr}) ,val({corebrthmn}), {@day})

Then your selection formula could be:

month({@birthday}) = month(currentdate)

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top