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!

Problem with "maximum"

Status
Not open for further replies.

tyrahat

Technical User
Apr 23, 2003
9
0
0
US
Crystal 8.5, Sybase 11

Copied this formula from one report to another, it works in the original report, not in the second.

"Last Update: " + Maximum ({system_info.DATE_TIME})[12 to 16]+" "+ToText(PrintDate)


Both report use the same DB, not sure why the error.

Error: String or Array expected here (by Maximum).

 
Assumming the {system_info.Date_time} is a date time field, I do not understadn how this could ever work. You need to convert your date time field to text first as follows:

"Last Update: " + totext(Maximum ({system_info.DATE_TIME}))[12 to 16]+" "+ToText(PrintDate)

Software Sales, Training, Implementation and Support for Exact Macola, eSynergy, and Crystal Reports
 
Strange, I know. But it works, I swear :)

 
I'd use dgillz's formula...swearing or not...I cannot see how your formula worked unless on hte first report it was a string and on the second it is a date.

I might change the formula slightly to reflect the structure of the date/time result since you are requiring specifically 5 characters in a specific location in the string

eg. ToText(maximum({system_info.DATE_TIME}),"yyyy/MM/dd hh:mm)[12 to 16]

Hmmmm...when I use this format it looks like all I am getting is the time of day

it would be simpler to use

"Last Update: " + totext(Maximum ({system_info.DATE_TIME}), "hh:mm") + " "+ToText(PrintDate)

no need for an array at all if this is the case.

Jim Broadbent

The quality of the answer is directly proportional to the quality of the problem statement!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top