AL icon indicating copy to clipboard operation
AL copied to clipboard

AL Compiler 4.0.176004 cannot handle option field in Flowfield when the optionstring is 0,1,2,..

Open mfalk118 opened this issue 7 years ago • 2 comments

Describe the bug Option fields with Integers as values cannot be handled in CalcFormula of Flowfield. Reservation Entry has such a field.

To Reproduce Steps and to reproduce the behavior: Extens sales line table with new field that calculates as:

AL Code to reproduce the issue

 field(50000; "Reserved Qty. on Inventory"; Decimal)
        {
            CalcFormula = sum ("Reservation Entry"."Quantity (Base)" where("Item No." = field("No."),
                                                                           "Source Type" = const(32),
                                                                           "Source Subtype" = const(0), //This line fails
                                                                           "Reservation Status" = const(Reservation),
                                                                           "Location Code" = field("Location Code"),
                                                                           "Variant Code" = field("Variant Code")));
            Caption = 'Reserved Qty. on Inventory';
            DecimalPlaces = 0 : 5;
            Description = 'Base';
            Editable = false;
            FieldClass = FlowField;
        }

Expected behavior Yesterday the compiler showed error on this. Today with the same version it does not, However when i try to publish the App i get an error like:

Tab37-Ext50000.SalesLine.al(288,101): error AL0383: The option value '0' is not defined on field 'Source Subtype'.

Screenshots If applicable, add screenshots to help explain your problem.

5. Versions:

  • AL Language: 4.0.176004 but runtime:3.0
  • Business Central: BC14 Cu4 (14.0.35916.0)

mfalk118 avatar Oct 03 '19 06:10 mfalk118

Hi @mfalk118, it seems that the newer version of the compiler fixes this issue, but that the issue still exists in the version of BC that you are using. When publishing an extension from VS Code, the AL code is compiled once in VS Code to create the package, and once in the server when publishing. This would explain why it fails when publishing with the same error you used to see.

Can you try reproducing this issue on the latest developer preview (version 15.x) and tell us if the issue still reproduces there?

qutreson avatar Oct 04 '19 07:10 qutreson

It seems to be solved. You can close this

mfalk118 avatar Oct 07 '19 06:10 mfalk118