TOPIC: Formula issue

Formula issue 01 May 2008 23:36 #166

  • brett_bsg
  • brett_bsg's Avatar
I have a report that I created in Crystal 10 that is accessing a datasource on an iSeries system using the Client Access ODBC connection. When I run the report via Crystal Reports, the report runs with no issues.

When I try to run the report using Logicity, I get an error on one of my formulas in the report:

A month number must be between 1 and 12
Details: errorkind
Error in.......
Error in formula <from_date>.

The formula for from_date is:

Local NumberVar date_val;
Local StringVar str_date;

date_val := {CKTIMEFL.TIPSTR};
str_date := CStr(date_val);

If date_val > 0 then
CDate (ToNumber(Mid(str_date,1,4)),
ToNumber(Mid(str_date,5,2)),
ToNumber(Mid(str_date,7,2))
);

The formula is converting a unique numeric date/time value into a regular date value. The only thing I can think of is that the libraries Logicity is using treat a zero field differently than how Crystal 10 is, and the formula is throwing an exception when the first record is found where TIPSTR is 0.

I get the error no matter if I run it on my PC or a PC with just Logicity installed.

Any ideas?

Brett
The administrator has disabled public write access.

Re:Formula issue 19 May 2008 18:45 #194

  • brett_bsg
  • brett_bsg's Avatar
Found the answer to my issue. The problem lies in a difference in how Crystal uses CStr/ToText in v10 and v11. The default in v10 converts my numeric string to a plain number, however the default in v11 adds in formatting with commas and a period. By changing the arguments on CStr to force a conversion the way I needed it, I was able to resolve the issue.
The administrator has disabled public write access.