Tuesday, November 27, 2018

How to define option String in Visual Studio Code for Dynamics 365 Business Central?

Dear Readers,

To define a option field in Visual Studio you need to write Code as :

        field(40;Type; Option)
{
            OptionMembers = "Instructor Led","e-learning","Remote Training";
            DataClassification = ToBeClassified;
        }

This will help you to define the Option Field in Visual Studio Code.

How to design a Table in AL using Visual Studio Code?

table 50100 MyTable
{
    DataClassification = ToBeClassified;
   
    fields
    {
        field(10;Code; Code [10])
        {
            DataClassification = ToBeClassified;
           
        }
        field(20;Name; Text [30])
        {
            DataClassification = ToBeClassified;
           
        }
        field(30;Description; Text [50])
        {
            DataClassification = ToBeClassified;
           
        }
        field(40;Type; Option)
        {
            OptionMembers = "Instructor Led","e-learning","Remote Training";
            DataClassification = ToBeClassified;
        }
        field(50; Duration; Decimal)
        {
            DataClassification = ToBeClassified;
        }
        field(60;Price; Decimal)
        {
            DataClassification = ToBeClassified;
           
        }
        field(70;Active; Boolean)
        {
            DataClassification = ToBeClassified;
        }
        field(80;Difficulty; Integer)
        {
            DataClassification = ToBeClassified;
        }
        field(90;"Passing Rate"; Integer)
        {
            DataClassification = ToBeClassified;
           
        }
        field(100;"Instructor Code"; Code [20])
        {
            DataClassification = ToBeClassified;
            TableRelation = Resource WHERE (Type=CONST(Person));
        }
        field(110; "Instructor Name"; Text [50])
        {
            Editable=false;
            FieldClass=FlowField;
            CalcFormula=lookup(Resource.Name where ("No."=field("Instructor Code")));
        }
    }
   
    keys
    {
        key(PK; Code)
        {
            Clustered = true;
        }
        key("Secondary Key 1"; "Instructor Code" ){}
        key("Secondary Key 2";Type){}
    }   
}

No comments:

Post a Comment