← Back to Benchmark Results

gemini/gemini-3.1-pro-preview

76.8%
Pass Rate
43/56
Tasks Passed
3
Runs
69.6%
pass@1
76.8%
pass@3
83.9%
Consistency
0.1
Temperature
-
Thinking
1,642,935
Tokens
$1.27
Cost
1st: 972nd: 20Failed: 1343/56 passed

Known Shortcomings (16)

Sorted by occurrence count (most frequent first)

# Concept AL Concept Count Affected Tasks
1 empty-or-missing-code-generation interface-definition 2 CG-AL-H021, CG-AL-M009

Description: The model failed to generate any valid AL code at all. The compilation error AL0198 'Expected one of the application object keywords' at position 1:1 indicates the generated file was either empty or contained no recognizable AL object declarations. The task required creating an interface 'INotificationChannel', three implementing codeunits (70221, 70222, 70223), and a manager codeunit (70220) using List of [Interface] and Dictionary of [Text, Interface] collections. The model produced no code (noted as 'Generated code not found'), resulting in a completely empty or invalid file.

Correct Pattern:
interface "INotificationChannel"
{
    procedure Send(Message: Text): Boolean;
    procedure GetChannelName(): Text;
}

codeunit 70221 "CG Email Channel"
{
    Access = Public;
    implements "INotificationChannel";

    procedure Send(Message: Text): Boolean
    begin
        exit(true);
    end;

    procedure GetChannelName(): Text
    begin
        exit('Email');
    end;
}

codeunit 70222 "CG SMS Channel"
{
    Access = Public;
    implements "INotificationChannel";

    procedure Send(Message: Text): Boolean
    begin
        exit(true);
    end;

    procedure GetChannelName(): Text
    begin
        exit('SMS');
    end;
}

codeunit 70223 "CG Slack Channel"
{
    Access = Public;
    implements "INotificationChannel";

    procedure Send(Message: Text): Boolean
    begin
        exit(true);
    end;

    procedure GetChannelName(): Text
    begin
        exit('Slack');
    end;
}

codeunit 70220 "CG Notification Manager"
{
    Access = Public;

    var
        ChannelList: List of [Interface "INotificationChannel"];
        ChannelDict: Dictionary of [Text, Interface "INotificationChannel"];

    procedure RegisterChannel(Channel: Interface "INotificationChannel")
    begin
        ChannelList.Add(Channel);
    end;

    procedure BroadcastMessage(Message: Text): Integer
    var
        Channel: Interface "INotificationChannel";
        SuccessCount: Integer;
    begin
        foreach Channel in ChannelList do
            if Channel.Send(Message) then
                SuccessCount += 1;
        exit(SuccessCount);
    end;

    procedure GetRegisteredChannelNames(): List of [Text]
    var
        Channel: Interface "INotificationChannel";
        Names: List of [Text];
    begin
        foreach Channel in ChannelList do
            Names.Add(Channel.GetChannelName());
        exit(Names);
    end;

    procedure RegisterNamedChannel(Name: Text; Channel: Interface "INotificationChannel")
    begin
        ChannelDict.Add(Name, Channel);
    end;

    procedure SendToChannel(Name: Text; Message: Text): Boolean
    var
        Channel: Interface "INotificationChannel";
    begin
        if ChannelDict.Get(Name, Channel) then
            exit(Channel.Send(Message));
        exit(false);
    end;

    procedure GetChannelByName(Name: Text; var Channel: Interface "INotificationChannel"): Boolean
    begin
        exit(ChannelDict.Get(Name, Channel));
    end;

    procedure ClearChannels()
    begin
        Clear(ChannelList);
        Clear(ChannelDict);
    end;
}
Incorrect Pattern:
// Generated code not found (empty or no output)

Error Codes: AL0198, AL0104

2 empty-or-missing-code-generation table-definition 2 CG-AL-M003, CG-AL-M112

Description: The model failed to generate any valid AL code at all. The compilation error AL0198 'Expected one of the application object keywords' at position 1:1 indicates the generated file was either empty or contained no recognizable AL object definition. The task required creating a complete 'Sales Contract' table (ID 70002) with fields, triggers, and validation logic, but the model produced no output (or invalid non-AL content). The task definition and test file are both correct and well-specified.

Correct Pattern:
table 70002 "Sales Contract"
{
    DataClassification = CustomerContent;
    Caption = 'Sales Contract';

    fields
    {
        field(1; "Contract No."; Code[20])
        {
            Caption = 'Contract No.';
            DataClassification = CustomerContent;
        }
        field(2; "Customer No."; Code[20])
        {
            Caption = 'Customer No.';
            TableRelation = Customer;
            DataClassification = CustomerContent;
        }
        field(3; "Start Date"; Date)
        {
            Caption = 'Start Date';
            DataClassification = CustomerContent;
        }
        field(4; "End Date"; Date)
        {
            Caption = 'End Date';
            DataClassification = CustomerContent;
            trigger OnValidate()
            begin
                if "End Date" <= "Start Date" then
                    Error('End Date must be after Start Date');
            end;
        }
        field(5; "Contract Value"; Decimal)
        {
            Caption = 'Contract Value';
            DataClassification = CustomerContent;
            trigger OnValidate()
            begin
                if "Contract Value" <= 0 then
                    Error('Contract Value must be positive');
            end;
        }
        field(6; Status; Option)
        {
            Caption = 'Status';
            OptionMembers = Draft,Active,Suspended,Terminated,Closed;
            DataClassification = CustomerContent;
        }
        field(7; "Payment Terms"; Code[10])
        {
            Caption = 'Payment Terms';
            TableRelation = "Payment Terms";
            DataClassification = CustomerContent;
        }
    }

    keys
    {
        key(PK; "Contract No.")
        {
            Clustered = true;
        }
    }

    trigger OnInsert()
    var
        NoSeriesMgt: Codeunit NoSeriesManagement;
    begin
        if "Contract No." = '' then
            "Contract No." := 'SC-' + Format(Database.CompanyName()) + Format(CurrentDateTime, 0, '<Year4><Month,2><Day,2><Hours24><Minutes,2><Seconds,2>');
        Status := Status::Draft;
    end;

    trigger OnDelete()
    begin
        if Status = Status::Active then
            Error('Cannot delete active contract');
    end;
}
Incorrect Pattern:

Error Codes: AL0198

3 empty-or-missing-code-generation codeunit-definition 1 CG-AL-E050

Description: The model failed to generate any valid AL code at all. The compilation error AL0198 'Expected one of the application object keywords' at position 1:1 indicates the generated file was either empty or contained no recognizable AL object declaration. The model should have produced a codeunit with ID 70050 named 'CG Text Builder' containing three procedures (GetSqlQuery, GetJsonTemplate, GetEmailBody) using multiline string literals. The task and tests are perfectly valid - the model simply failed to produce any output.

Correct Pattern:
codeunit 70050 "CG Text Builder"
{
    Access = Public;

    procedure GetSqlQuery(): Text
    begin
        exit(
'SELECT CustomerNo, Name, Balance
FROM Customer
WHERE Active = true
ORDER BY Name');
    end;

    procedure GetJsonTemplate(): Text
    begin
        exit(
'{
  "type": "invoice",
  "version": "1.0",
  "data": null
}');
    end;

    procedure GetEmailBody(CustomerName: Text): Text
    begin
        exit(
'Dear ' + CustomerName + ',

Thank you for your order.

Best regards,
Sales Team');
    end;
}
Incorrect Pattern:
// Generated code not found

Error Codes: AL0198

4 table-extension-with-page-extension page-extension 1 CG-AL-E006

Description: The model failed to generate any code at all ('Generated code not found'). The task requires creating both a table extension on the Customer table (table 18) to add the new fields ('Preferred Contact Method', 'Customer Notes', 'VIP Customer') and a page extension on the Customer Card (page 21) to display those fields in the General group. The compilation errors show that the Customer record doesn't contain the new fields, meaning the model did not produce the necessary table extension to define these fields, nor the page extension. The model either produced empty output or output that wasn't captured.

Correct Pattern:
tableextension 70000 "Customer Table Extension" extends Customer
{
    fields
    {
        field(70000; "Preferred Contact Method"; Option)
        {
            Caption = 'Preferred Contact Method';
            OptionMembers = Email,Phone,Mail,SMS;
            OptionCaption = 'Email,Phone,Mail,SMS';
        }
        field(70001; "Customer Notes"; Text[500])
        {
            Caption = 'Customer Notes';
        }
        field(70002; "VIP Customer"; Boolean)
        {
            Caption = 'VIP Customer';
        }
    }
}

pageextension 70000 "Customer Card Extension" extends "Customer Card"
{
    layout
    {
        addlast(General)
        {
            field("Preferred Contact Method"; Rec."Preferred Contact Method")
            {
                ApplicationArea = All;
                Caption = 'Preferred Contact Method';
            }
            field("Customer Notes"; Rec."Customer Notes")
            {
                ApplicationArea = All;
                Caption = 'Customer Notes';
            }
            field("VIP Customer"; Rec."VIP Customer")
            {
                ApplicationArea = All;
                Caption = 'VIP Customer';
            }
        }
    }
}
Incorrect Pattern:
// Generated code not found

Error Codes: AL0132

5 al-syntax-structure codeunit-procedure-syntax 1 CG-AL-H022

Description: The model generated code with syntax errors around line 107 of the output file. The compilation errors (Expression expected, ')' expected, 'end' expected) indicate the model produced malformed AL code, likely with incorrect procedure signatures, missing begin/end blocks, or improper use of RecordRef/FieldRef APIs. The generated code was not captured ('Generated code not found'), but the errors at line 107 suggest the model struggled with the complex procedure definitions involving var parameters, Variant types, or error handling patterns (TryFunction or if/then with RecordRef.Open). The task and test definitions are valid - this is a model failure to produce syntactically correct AL code for advanced RecordRef/FieldRef manipulation patterns.

Correct Pattern:
codeunit 70224 "CG Dynamic Record Handler"
{
    Access = Public;

    procedure GetTableName(TableId: Integer): Text
    var
        RecRef: RecordRef;
        TableName: Text;
    begin
        if not TryOpenTable(RecRef, TableId) then
            exit('');
        TableName := RecRef.Name;
        RecRef.Close();
        exit(TableName);
    end;

    [TryFunction]
    local procedure TryOpenTable(var RecRef: RecordRef; TableId: Integer)
    begin
        RecRef.Open(TableId);
    end;
    // ... remaining procedures with proper syntax
}
Incorrect Pattern:
// Generated code not found - but errors at line 107 indicate syntax issues in the generated codeunit

Error Codes: AL0224

6 secrettext-isolated-storage-syntax secrettext-handling 1 CG-AL-H016

Description: The model failed to generate valid AL code for the 'CG Secure Storage' codeunit. The compilation errors (AL0104 syntax errors around line 21) indicate the model produced syntactically invalid AL code, likely struggling with SecretText type handling, IsolatedStorage API usage with SecretText parameters, and the correct syntax for unwrapping SecretText values. The generated code was not even captured ('Generated code not found'), suggesting the model either produced malformed output or failed to properly structure the codeunit. The task and tests are valid - the model simply lacks sufficient knowledge of SecretText patterns in AL, including how to use IsolatedStorage.Set/Get with SecretText, how to unwrap SecretText values, and how to properly work with the SecretText type in procedure signatures.

Correct Pattern:
codeunit 70016 "CG Secure Storage"
{
    procedure StoreApiKey(ApiKey: SecretText)
    begin
        IsolatedStorage.Set('CG_API_KEY', ApiKey, DataScope::Module);
    end;

    procedure RetrieveApiKey(): SecretText
    var
        RetrievedKey: SecretText;
    begin
        IsolatedStorage.Get('CG_API_KEY', DataScope::Module, RetrievedKey);
        exit(RetrievedKey);
    end;

    procedure BuildAuthHeader(ApiKey: SecretText): Text
    begin
        exit('Bearer ' + ApiKey.Unwrap());
    end;

    procedure ValidateCredentials(Username: Text; Password: SecretText): Boolean
    begin
        if Username = '' then
            exit(false);
        if Password.Unwrap() = '' then
            exit(false);
        exit(true);
    end;

    procedure MaskSecret(Secret: SecretText): Text
    var
        Unwrapped: Text;
    begin
        Unwrapped := Secret.Unwrap();
        if StrLen(Unwrapped) <= 4 then
            exit(Unwrapped + '****');
        exit(CopyStr(Unwrapped, 1, 4) + '****');
    end;
}
Incorrect Pattern:
// Generated code not found - model produced syntactically invalid AL code with errors around line 21

Error Codes: AL0104

7 empty-or-missing-code-generation al-object-definition 1 CG-AL-H005

Description: The model failed to generate any valid AL code. The compilation error AL0198 'Expected one of the application object keywords' at position 1:1 indicates the generated file was either empty or contained no recognizable AL object definitions. The task required creating two tables (CG Audit Log 70206 and CG Tracked Item 70207) with specific fields and an OnModify trigger, but the model produced no code at all (or invalid non-AL content).

Correct Pattern:
table 70206 "CG Audit Log"
{
    DataClassification = CustomerContent;

    fields
    {
        field(1; "Entry No."; Integer)
        {
            AutoIncrement = true;
        }
        field(2; "Table ID"; Integer) { }
        field(3; "Record ID"; RecordId) { }
        field(4; "Field Changed"; Text[50]) { }
        field(5; "Old Value"; Text[250]) { }
        field(6; "New Value"; Text[250]) { }
        field(7; "Changed At"; DateTime) { }
        field(8; "Changed By"; Code[50]) { }
    }

    keys
    {
        key(PK; "Entry No.") { Clustered = true; }
    }
}

table 70207 "CG Tracked Item"
{
    DataClassification = CustomerContent;

    fields
    {
        field(1; Code; Code[20]) { }
        field(2; Description; Text[100]) { }
        field(3; "Unit Price"; Decimal) { }
        field(4; Blocked; Boolean) { }
    }

    keys
    {
        key(PK; Code) { Clustered = true; }
    }

    trigger OnModify()
    var
        AuditLog: Record "CG Audit Log";
    begin
        if Rec."Unit Price" <> xRec."Unit Price" then begin
            AuditLog.Init();
            AuditLog."Field Changed" := 'Unit Price';
            AuditLog."Old Value" := Format(xRec."Unit Price");
            AuditLog."New Value" := Format(Rec."Unit Price");
            AuditLog."Changed At" := CurrentDateTime;
            AuditLog."Changed By" := CopyStr(UserId, 1, 50);
            AuditLog.Insert(true);
        end;
        if (xRec.Blocked = false) and (Rec.Blocked = true) then begin
            AuditLog.Init();
            AuditLog."Field Changed" := 'Blocked';
            AuditLog."Old Value" := 'No';
            AuditLog."New Value" := 'Yes';
            AuditLog."Changed At" := CurrentDateTime;
            AuditLog."Changed By" := CopyStr(UserId, 1, 50);
            AuditLog.Insert(true);
        end;
    end;
}
Incorrect Pattern:

Error Codes: AL0198

8 table-field-naming-conventions api-page-with-backing-table 1 CG-AL-M001

Description: The model failed to generate any code at all ('Generated code not found'). The task required creating both a Product table and a 'Product API' page. The compilation errors show that the test file references Product."No." which means the model needed to create a Product table with a field named "No." (Code[20]) as the primary key, along with Description, "Unit Price", "Stock Quantity", "Category Id" fields, and an API page exposing these with camelCase field names (productCode mapping to "No.", description, unitPrice, stockQuantity, categoryId). The model produced no output whatsoever, indicating a fundamental failure to generate the required AL objects (table + API page) for this medium-complexity task.

Correct Pattern:
table 70100 Product
{
    DataClassification = CustomerContent;
    fields
    {
        field(1; "No."; Code[20]) { Caption = 'No.'; }
        field(2; Description; Text[100]) { Caption = 'Description'; }
        field(3; "Unit Price"; Decimal) { Caption = 'Unit Price'; }
        field(4; "Stock Quantity"; Integer) { Caption = 'Stock Quantity'; }
        field(5; "Category Id"; Code[20]) { Caption = 'Category Id'; }
    }
    keys
    {
        key(PK; "No.") { Clustered = true; }
    }
    trigger OnInsert()
    begin
        if "Unit Price" < 0 then Error('Price must be positive');
        if "Stock Quantity" < 0 then Error('Stock must be non-negative');
    end;
    trigger OnModify()
    begin
        if "Unit Price" < 0 then Error('Price must be positive');
        if "Stock Quantity" < 0 then Error('Stock must be non-negative');
    end;
}

page 70100 "Product API"
{
    PageType = API;
    APIPublisher = 'mycompany';
    APIGroup = 'products';
    APIVersion = 'v1.0';
    EntityName = 'product';
    EntitySetName = 'products';
    SourceTable = Product;
    DelayedInsert = true;
    ODataKeyFields = SystemId;
    layout
    {
        area(Content)
        {
            repeater(Group)
            {
                field(id; Rec.SystemId) { Caption = 'Id'; }
                field(productCode; Rec."No.") { Caption = 'Product Code'; }
                field(description; Rec.Description) { Caption = 'Description'; }
                field(unitPrice; Rec."Unit Price") { Caption = 'Unit Price'; }
                field(stockQuantity; Rec."Stock Quantity") { Caption = 'Stock Quantity'; }
                field(categoryId; Rec."Category Id") { Caption = 'Category Id'; }
            }
        }
    }
}
Incorrect Pattern:
// Generated code not found

Error Codes: AL0000

9 errorinfo-customdimensions-codeunit-structure error-handling-errorinfo 1 CG-AL-H007

Description: The model failed to generate valid AL code for the codeunit and enum. The compilation errors at line 29 (syntax error, ':' expected, 'begin' is a keyword) indicate the model produced structurally malformed AL code - likely missing or malformed procedure signatures, or incorrectly structured the codeunit/enum definitions. The generated code was not even captured ('Generated code not found'), suggesting the model may have produced output that couldn't be properly parsed, or produced code with fundamental structural issues like missing procedure declarations before 'begin' blocks. The task and tests are valid; the model simply failed to produce correct AL syntax for ErrorInfo.Create(), CustomDimensions dictionary usage, and proper codeunit structure.

Correct Pattern:
codeunit 70210 "CG Validation Engine"
{
    Access = Public;

    procedure CreateValidationError(ErrorCode: Enum "CG Validation Error"; FieldName: Text; ErrorMessage: Text): ErrorInfo
    var
        ErrInfo: ErrorInfo;
        CustomDimensions: Dictionary of [Text, Text];
    begin
        CustomDimensions.Add('ErrorCode', Format(ErrorCode.AsInteger()));
        CustomDimensions.Add('FieldName', FieldName);
        ErrInfo.Message(ErrorMessage);
        ErrInfo.CustomDimensions(CustomDimensions);
        ErrInfo.Collectible(IsCollectingErrors());
        exit(ErrInfo);
    end;

    procedure GetErrorCode(ErrInfo: ErrorInfo): Enum "CG Validation Error"
    var
        ErrorCodeText: Text;
        ErrorCodeInt: Integer;
    begin
        ErrorCodeText := ErrInfo.CustomDimensions.Get('ErrorCode');
        Evaluate(ErrorCodeInt, ErrorCodeText);
        exit(Enum::"CG Validation Error".FromInteger(ErrorCodeInt));
    end;

    procedure ValidateNotEmpty(Value: Text; FieldName: Text)
    var
        ErrInfo: ErrorInfo;
    begin
        if Value = '' then begin
            ErrInfo := CreateValidationError("CG Validation Error"::EmptyField, FieldName, 'Field cannot be empty');
            Error(ErrInfo);
        end;
    end;

    procedure ValidateInRange(Value: Decimal; MinValue: Decimal; MaxValue: Decimal; FieldName: Text)
    var
        ErrInfo: ErrorInfo;
    begin
        if (Value < MinValue) or (Value > MaxValue) then begin
            ErrInfo := CreateValidationError("CG Validation Error"::OutOfRange, FieldName, StrSubstNo('Value must be between %1 and %2', MinValue, MaxValue));
            Error(ErrInfo);
        end;
    end;
}
Incorrect Pattern:
Generated code not found - but compilation errors at line 29 suggest malformed procedure structure with 'begin' appearing where a declaration was expected

Error Codes: AL0104

10 al-conditional-syntax control-flow-syntax 1 CG-AL-M005

Description: The model generated AL code with syntax errors around conditional statements (if/then/else blocks) at line 104 and surrounding lines. The compilation errors indicate missing 'then' keyword and mismatched 'end' statements, which are fundamental AL syntax issues. The generated code was not captured/saved but the errors clearly show the model produced malformed control flow structures in the codeunit implementation. This is a model knowledge gap in producing syntactically correct AL conditional logic, likely involving retry logic or error handling patterns requested by the task.

Correct Pattern:
if Condition then begin
    // statements
end else begin
    // statements
end;
Incorrect Pattern:
Code around line 104 with malformed if/then/else or begin/end blocks (generated code not captured but errors indicate syntax issues in conditional statements)

Error Codes: AL0104

11 complex-codeunit-generation-syntax codeunit-with-interface-and-recordref 1 CG-AL-H023

Description: The model failed to generate syntactically valid AL code for a complex codeunit involving RecordRef/FieldRef manipulation, interfaces, and multiple procedures. The compilation errors at line 25 (semicolon expected, 'end' expected) and line 35-36 (expression expected, multiple semicolon errors) indicate the model produced malformed AL code with fundamental syntax issues - likely incorrect procedure declarations, missing begin/end blocks, or improperly structured interface definitions. The generated code file was noted as 'not found' in the analysis but the compilation errors clearly show the model attempted to generate code that had basic structural/syntax problems. This is a complex task requiring 10 procedures, an interface definition, and extensive use of RecordRef/FieldRef APIs, which the model failed to produce correctly.

Correct Pattern:
interface "IFieldTransformer"
{
    procedure Transform(var FRef: FieldRef): Variant;
}

codeunit 70226 "CG Record Introspector"
{
    Access = Public;

    procedure SerializeToJson(SourceRecord: Variant): JsonObject
    var
        RecRef: RecordRef;
        FRef: FieldRef;
        ...
    begin
        ...
    end;
    // ... properly structured procedures with begin/end blocks
}
Incorrect Pattern:
Generated code not available but compilation errors at lines 25, 35-36 indicate malformed procedure bodies or interface definitions with missing semicolons, missing end statements, and incorrect expression syntax

Error Codes: AL0111

12 al-conditional-syntax control-flow-statements 1 CG-AL-M008

Description: The model generated AL code with syntax errors in conditional statements (if/then/else blocks). The compilation errors indicate issues at line 22 with 'then' expected, orphaned ELSE statements due to unnecessary semicolons before ELSE keywords, and general structural syntax problems. The generated code was not captured but the errors clearly show the model produced malformed if-then-else constructs and had semicolons before ELSE keywords, which is a common AL syntax mistake. The task and test definitions are valid - this is purely a code generation quality issue.

Correct Pattern:
In AL, if-then-else must follow: if <condition> then begin ... end else begin ... end; — no semicolon before 'else', and 'then' keyword is required after the condition.
Incorrect Pattern:
Code not captured, but errors indicate malformed if/then/else blocks with semicolons before ELSE and missing 'then' keywords around lines 22-38

Error Codes: AL0104

13 multi-object-al-file-structure al-object-definition-syntax 1 CG-AL-M010

Description: The model generated syntactically invalid AL code for a multi-object scenario. The compilation errors (AL0124 'The property Data cannot be used in this context', AL0104 syntax errors for '=' expected, '{' expected, '}' expected, and AL0198 expecting application object keywords) indicate the model produced malformed AL object definitions. The errors suggest the model likely used incorrect property syntax (e.g., a 'Data' property that doesn't exist in the context used), had structural issues with object definitions (missing or misplaced braces/equals signs), and failed to properly separate or define multiple AL objects (table, page, codeunit) in a single file. The task and tests are valid - this is purely a model code generation failure.

Correct Pattern:
Each AL object (table 70003 Project, table 70004 "Project Task", page 70102 "Project Card", codeunit 70005 "Project Management") should be properly defined with correct syntax: table ID Name { fields { field(ID; Name; Type) { } } } and proper trigger/procedure definitions within each object block.
Incorrect Pattern:
Generated code not available but errors at line 25 show 'Data' property misuse and line 51 shows missing object structure keywords

Error Codes: AL0124

14 yaml-parsing-al-syntax string-parsing-control-flow 1 CG-AL-M021

Description: The model generated AL code with syntax errors around line 20 and 143, likely involving incorrect control flow syntax (missing 'then' after 'if' conditions, incorrect block structure). The compilation errors indicate the model produced malformed AL code with syntax issues in conditional statements and block endings. The task and tests are valid - the model simply failed to produce syntactically correct AL code for YAML string parsing logic. The errors at lines 20 and 143 both show 'then expected' followed by 'end expected', suggesting the model used an incorrect pattern for if-then blocks, possibly mixing syntax from another language (e.g., using curly braces or missing 'then' keyword after if conditions).

Correct Pattern:
In AL, if statements must follow the pattern: if <condition> then begin ... end; The 'then' keyword is mandatory after the condition expression, and 'begin'/'end' blocks must be properly paired.
Incorrect Pattern:
// Generated code not available but errors indicate missing 'then' keywords and incorrect block structure around lines 20 and 143

Error Codes: AL0104

15 complex-report-with-helper-codeunit report-definition-and-codeunit-generation 1 CG-AL-M007

Description: The model failed to generate any valid AL code at all. The task required creating both a Report 70001 'Sales Performance Analysis' and a helper codeunit 'CG-AL-M007 Mock Calculator' that the test file references. The compilation error AL0198 indicates the generated file was empty or contained no valid AL object declaration. The model needed to produce: (1) a report object with Customer, Sales Header, and Sales Line data items with complex calculations, and (2) a codeunit implementing MockCalculator with procedures like Initialize, AddSalesLine, GetRunningTotalByCustomer, GetRunningTotalByRegion, CalculateAverageOrderValue, GetCustomerRank, GetTopProduct, GetProductSalesQuantity, CalculateYoYComparison, CalculateOrderFrequency, GetTotalSales, and GetCustomerCount. The model produced no code (empty output).

Correct Pattern:
report 70001 "Sales Performance Analysis"
{
    UsageCategory = ReportsAndAnalysis;
    ApplicationArea = All;
    DefaultRenderingLayout = RDLCLayout;
    dataset
    {
        dataitem(Customer; Customer) { ... }
        dataitem(SalesHeader; "Sales Header") { DataItemLink = "Sell-to Customer No." = field("No."); ... }
        dataitem(SalesLine; "Sales Line") { DataItemLink = "Document No." = field("No."); ... }
    }
    requestpage { ... }
    rendering { layout(RDLCLayout) { Type = RDLC; LayoutFile = '...'; } }
}

codeunit 70001 "CG-AL-M007 Mock Calculator"
{
    procedure Initialize() ...
    procedure AddSalesLine(CustomerCode: Code[20]; Region: Code[20]; ItemCode: Code[20]; Quantity: Decimal; Amount: Decimal) ...
    procedure GetRunningTotalByCustomer(CustomerCode: Code[20]): Decimal ...
    procedure GetRunningTotalByRegion(Region: Code[20]): Decimal ...
    procedure CalculateAverageOrderValue(): Decimal ...
    procedure GetCustomerRank(CustomerCode: Code[20]): Integer ...
    procedure GetTopProduct(): Code[20] ...
    procedure GetProductSalesQuantity(ItemCode: Code[20]): Decimal ...
    procedure CalculateYoYComparison(CurrentYear: Decimal; PreviousYear: Decimal): Decimal ...
    procedure CalculateOrderFrequency(OrderCount: Integer; Days: Integer): Decimal ...
    procedure GetTotalSales(): Decimal ...
    procedure GetCustomerCount(): Integer ...
}
Incorrect Pattern:

Error Codes: AL0198

16 string-literal-termination al-syntax-basics 1 CG-AL-M004

Description: The model generated AL code with improperly terminated text literals (string constants). The compilation errors AL0360 at line 103 and 105 indicate that single-quote delimited string literals were not properly closed. This is a basic AL syntax issue where the model likely included an unescaped single quote within a MESSAGE string or used incorrect quoting. For example, in the ApplyDiscount action's Confirm/Message call, the model probably wrote a string containing an apostrophe that broke the literal, or split a string across lines incorrectly.

Correct Pattern:
// Properly terminated string literals in AL use single quotes, and embedded single quotes must be doubled:
Message('Order No. %1 - Amount: %2, Amount Including VAT: %3', Rec."No.", Rec.Amount, Rec."Amount Including VAT");
// For Confirm:
if Confirm('Do you want to apply a 10%% discount to order %1?', true, Rec."No.") then begin
    // apply discount logic
    Message('Discount applied successfully.');
end;
Incorrect Pattern:
// Exact generated code not available, but based on errors at lines 103-105, the model likely wrote something like:
Message('Order No. ' + Rec."No." + ' totals: Amount = ' + Format(Rec.Amount) + ', Amount Including VAT = ' + Format(Rec."Amount Including VAT"));
// or a Confirm call with improperly terminated string literal

Error Codes: AL0360