AL icon indicating copy to clipboard operation
AL copied to clipboard

Reference 'Enum Field' in application object 'Test Enum Table' does not exist

Open FSharpCSharp opened this issue 7 years ago • 6 comments

Describe the bug A very simple use case: You create a new table that has an enum field and additionally a FlowField that accesses this enum field. When compiling, the following error appear:

"Reference 'Enum Field' in application object 'Test Enum Table' does not exist"

To Reproduce Steps and/or AL code to reproduce the behavior:

enum 50000 "Test Enum"
{
    Extensible = true;

    value(0; Test)
    {
    }
    value(1; "Test 2")
    {
    }
}

table 50000 "Test Enum Table"
{
    DataClassification = CustomerContent;

    fields
    {
        field(1; "Primary Key"; Integer)
        {
            DataClassification = CustomerContent;

        }

        field(2; "Enum Field"; Enum "Test Enum")
        {

        }

        field(3; "Test Flow Field"; Integer)
        {
            BlankZero = true;
            FieldClass = FlowField;
            CalcFormula = Count ("Test Enum Table" WHERE ("Enum Field" = CONST (Test)));
        }
    }


    keys
    {
        key(PK; "Primary Key")
        {
            Clustered = true;
        }
    }
}

Expected behavior The usage must work in the same way as it used to work with option fields.

Versions:

  • AL Langauge: 2.0.58805
  • Business Central: 13.0.25924

FSharpCSharp avatar Dec 06 '18 08:12 FSharpCSharp

This has been fixed in the latest preview and it will be available in the next CUs.

atoader avatar Dec 11 '18 17:12 atoader

Hi @atoader. I installed new CU4 of BC on-premises but this fix isn't there.

Versions:

  • AL Language: 2.1.79379
  • Business Central: 13.0.27183

ghost avatar Jan 26 '19 16:01 ghost

Hi @atoader. I installed new CU4 of BC on-premises but this fix isn't there.

Versions:

  • AL Language: 2.1.79379
  • Business Central: 13.0.27183

Hi @FSharpCSharp ,

I'm using same version as @dejfidson mentioned and is working fine, only thing I changed in your code is filtered the index of enum field. "CalcFormula = Count ("Test Enum Table" WHERE ("Enum Field" = filter (0)));"

nareshbandariD365 avatar Feb 05 '19 06:02 nareshbandariD365

Hi @atoader. I installed new CU4 of BC on-premises but this fix isn't there. Versions:

  • AL Language: 2.1.79379
  • Business Central: 13.0.27183

Hi @FSharpCSharp ,

I'm using same version as @dejfidson mentioned and is working fine, only thing I changed in your code is filtered the index of enum field. "CalcFormula = Count ("Test Enum Table" WHERE ("Enum Field" = filter (0)));"

it's a workaround, but certinly a bad practice, let's see when this is fixed and we should be able to use Const and Filter with something like "Enum Object"::[Option]

babak2000ir avatar Feb 13 '19 13:02 babak2000ir

@babak2000ir fixes are implemented only in the master branch which corresponds to the next major release. You can access Docker images from this branch through the Collaborate program.

atoader avatar Feb 19 '19 07:02 atoader

Hi @atoader - has this been fixed in last version of BC ?

gtrennert avatar Nov 04 '21 20:11 gtrennert