Date Formula

Anyone help me with this I am attempting to simply list the start and end dates for the last 12 months? I get a time/date error message Thanks Y=Integer sd=code dim 12 ed=code dim 12 sd2=date dim12 ed2=date dim12 FOR Y:=1 TO 12 DO BEGIN sd[Y]:=’-[y]m-cm’; sd2[Y]:= CALCDATE(sd[Y]); ed[Y]:=’-[y]m+cm’; ed2[Y]:= CALCDATE(ed[Y]); END;

The Date virtual table will get you all that without needing the CALCDATE stuff. From a quick codeunit: DateTable.SETFILTER("Period Type",'%1', DateTable."Period Type"::Month); DateTable.SETRANGE("Period Start",010105D,123105D); IF DateTable.FIND('-') THEN REPEAT MESSAGE('First Day: %1, Last Day: %2', DateTable."Period Start", NORMALDATE(DateTable."Period End")); UNTIL DateTable.NEXT = 0; Django

To answer your questions anyway … You assign a text to sd[Y] but C/AL does not replace the [Y] within you text with the actual integer value, your code should look like this sd[Y]:=’-’ + Y + ‘m-cm’; or a bit more elegant: sd[Y] := STRSUBSTNO(’-%1M-CM’,Y) Anyway, you should use Django’s suggestion that is much easier to handle… Saludos Nils