Options

Syntax Error - too many END ELSE BEGIN

brother_georgebrother_george Member Posts: 4
I'm not sure where I went wrong here. I'm getting a syntax error on the second set of "END ELSE BEGIN":


IF AgingMethod = AgingMethod::"Due Date" THEN BEGIN
PeriodEndingDate[2] := PeriodEndingDate[1];
FOR j := 4 TO 5 DO
PeriodEndingDate[j] := CALCDATE('-('+PeriodCalculation+')',PeriodEndingDate[j-1]);
END ELSE BEGIN
FOR j := 3 TO 5 DO
PeriodEndingDate[j] := CALCDATE('-('+PeriodCalculation+')',PeriodEndingDate[j-1]);
END ELSE BEGIN
FOR j := 2 TO 4 DO
PeriodEndingDate[j] := CALCDATE('-('+PeriodCalculation+')',PeriodEndingDate[j-1]);
END;
PeriodEndingDate[5] := 0D;
CompanyInformation.GET;
GLSetup.GET;
FilterString := Customer.GETFILTERS;

Comments

  • Options
    KYDutchieKYDutchie Member Posts: 345
    Hi,

    you can only have one "ELSE" per "IF"- statement.

    Regards,

    Willy
    Fostering a homeless, abused child is the hardest yet most rewarding thing I have ever done.
  • Options
    SavatageSavatage Member Posts: 7,142
    edited 2010-05-21
    if it's = to due date
    it does the 4 to 5 line else
    it does the 3 to 5 line.
    How do you expect it to get to the 2 to 4 line?

    Are you trying to do more like a case statement?

    (Quick example)
    CASE AgingMethod = AgingMethod::"Due Date":
    BEGIN
    PeriodEndingDate[2] := PeriodEndingDate[1];
    FOR j := 4 TO 5 DO
    PeriodEndingDate[j] := CALCDATE('-('+PeriodCalculation+')',PeriodEndingDate[j-1]);
    END;
    case AgingMethod = AgingMethod::"Doc Date":
    begin
    FOR j := 3 TO 5 DO
    PeriodEndingDate[j] := CALCDATE('-('+PeriodCalculation+')',PeriodEndingDate[j-1]);
    end;
    case AgingMethod = AgingMethod::"trans Date":
    begin
    FOR j := 2 TO 4 DO
    PeriodEndingDate[j] := CALCDATE('-('+PeriodCalculation+')',PeriodEndingDate[j-1]);
    END;

    PeriodEndingDate[5] := 0D;
    CompanyInformation.GET;
    GLSetup.GET;
    FilterString := Customer.GETFILTERS;
  • Options
    SavatageSavatage Member Posts: 7,142
Sign In or Register to comment.