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

Date if statement displaying string

Status
Not open for further replies.

CalgaryCR9

Technical User
Aug 12, 2005
80
CA
I'm using Crystal Reports 9.

What I want to do is basically an if statement, but am having problems with syntax.

if {SERVICE_CALL_EVENT.SVC_CALL_EVENT_TYPE}="ESCALATE_VEND"
then {SERVICE_CALL_EVENT.ACTION_DT}
else "No Escalation"


When I do the above, I get error "A date-time is required here". I understand the error, but would still like to print my string.

SERVICE_CALL_EVENT = table
SERVICE_CALL_EVENT.SVC_CALL_EVENT_TYPE = data field
SERVICE_CALL_EVENT.ACTION_DT = data field
"ESCALATE_VEND" = one potential table entry

 
Crystal will only let you have one output type for a formula

In your formula:

if {SERVICE_CALL_EVENT.SVC_CALL_EVENT_TYPE}="ESCALATE_VEND"
then {SERVICE_CALL_EVENT.ACTION_DT}
else "No Escalation"

Line two is a Date output, and Line 3 is a Text output

You can change Line two to something like:

ToText({SERVICE_CALL_EVENT.ACTION_DT}, "MM/dd/yyyy")

and this will cause your Date field to be printed as a Text String, which is compatible with the line 3 text String.

Check your CR9 Help for the ToText function for more details on specific ToText formats.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top