John

I haven't tried this but try using double digits for all the months - 01 for Jan, etc. I have done this for many years and it helps with sorting also.

Regards

Stan
Stan Millar
Director
Bromac Business Services Pty Ltd
FileMaker Database Development
Member of the FileMaker Technical Network
http://www.bromac.com.au/
Ph +61 7 3397 9998
Fax +61 7 3910 1092



On 13/10/2009, at 8:08 AM, John Wenmeekers wrote:

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