I have a problem with the Substitute() logic.

I have 3 fields:
previousMonth
month
nextMonth

The month field is a text field with a value list with a 3 letter abbrev of the 
months (Jan, Feb, Mar, ..... etc)

Out of that field I calc the month number with a custom function and do ( -1) 
for the previous month(number) and (+ 1) for the next month(number)

To have the previous and next month Name, I substitute the number:

Substitute ( nextMonth_cn; 
[1; "Jan"];
[2; "Feb"];
[2; "Mar"];
[4; "Apr"];
[5; "May"];
[6; "Jun"];
[7; "Jul"];
[8; "Aug"];
[9; "Sep"];
[10; "Oct"];
[11; "Nov"];
[12; "Dec"]
)

The results are fine, except when I reach the month October.
The previous month returns as Sep, but the next month returns as JanJan.

November (Nov) gives Jan0 as previous and JanFeb as next month.

It is obvious that the substitute() takes the numbers 10, 11 and 12 as 
separate digits.

I'm looking for a logical explanation of this substitute behavior.
We're using FM 8.5A on Win2k.

TIA

Reply via email to