Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Use this event to

Excerpt

Create new Configuration (collection of HeaderFields) or Add HeaderFields to existing headers.

...

DataTables ("ListData") that can be used from Steps and HeaderConfigurations.


DataTables are static data in Reference Data, meaning they are loaded on login and cannot change dynamically.

The header fields are the first thing the user sees when using any function at the mobile device.

Description

...


Description

A DataTable is a lists of "entries" sharing a common DataTableId, usually used to fill options in dropdown-lists at the Mobile Device (for Steps or HeaderConfigurations).

New DataTables can be created using "Create"-methods from the input parameter-table.:

  • Call _HeaderConfigurationElementDataTable.CreateInitDataTable(...) to "set" the ConfigurationKey DataTableId prior to adding new HeaderFieldsentries for that Id.
  • "Create_...Field"-methods will take a few, mandatory arguments.
  • "Create_...Field"-methods usually will offer an alternative argument list (other signature) that includes mandatory arguments as well as most commonly used optional arguments.
  • Optional values can also be set subsequently using a number of related "Set_"-methods.

  • Consider using Set_listValues from Steps or HeaderConfigurations in case your lists never changes (ie. optionvalue)

Supersedes OnGetReferenceData_OnAfterAddListDataAsXml

...

Template

    [EventSubscriber(ObjectType::CodeunitCodeunit::"MOB WMS Reference Data", 'OnGetReferenceData_OnAddDataTables''', true, true)]
    procedure OnGetReferenceData_OnAddDataTables(var _DataTable: Record "MOB DataTable Element")
    begin
        with _DataTable do begin
            InitDataTable('MyCustomDataTableId');   // Replace with your own dataTable identifier to be used with Set_dataTable(...) from Steps and HeaderConfigurations


            // Create your DataTable entries here
            // ...
            ;
        end;
    end;

Example (1)

    // [Example] 01 - Create new custom DataTable based on BC table using a Create_XXX template
    [EventSubscriber(ObjectType::CodeunitCodeunit::"MOB WMS Reference Data", 'OnGetReferenceData_OnAddDataTables''', true, true)]
    procedure My01OnGetReferenceData_OnAddDataTables(var _DataTable: Record "MOB DataTable Element")
    var
        CountryRegion: Record "Country/Region";
    begin
        with _DataTable do begin
            InitDataTable('MyCountries');

            if CountryRegion.FindFirst() then
                repeat
                    Create_CodeAndName(CountryRegion.Code, CountryRegion.Name);
                until CountryRegion.Next() 0;
        end;
    end;

Example (2)

    // [Example] 02 - Create new custom DataTable based on with no use of templates
    [EventSubscriber(ObjectType::CodeunitCodeunit::"MOB WMS Reference Data", 'OnGetReferenceData_OnAddDataTables''', true, true)]
    procedure My02OnGetReferenceData_OnAddDataTables(var _DataTable: Record "MOB DataTable Element")
    var
        CountryRegion: Record "Country/Region";
    begin
        with _DataTable do begin
            InitDataTable('MyCountryDetails');

            if CountryRegion.FindFirst() then
                repeat
                    Create();
                    SetValue('Code', CountryRegion.Code);
                    SetValue('ISOCode', CountryRegion."ISO Code");
                    SetValue('EUCode', CountryRegion."EU Country/Region Code");
                until CountryRegion.Next() 0;
        end;
    end;

Example (3)

    // [Example] 03 - Create new custom DataTable based on optionfield
    [EventSubscriber(ObjectType::CodeunitCodeunit::"MOB WMS Reference Data", 'OnGetReferenceData_OnAddDataTables''', true, true)]
    procedure My03OnGetReferenceData_OnAddDataTables(var _DataTable: Record "MOB DataTable Element")
    var
        SalesHeader: Record "Sales Header";
        OptionIdx: Integer;
    begin
        with _DataTable do begin
            InitDataTable('MyDocumentTypes');

            for OptionIdx := SalesHeader."Document Type"::Quote to SalesHeader."Document Type"::"Return Order" do begin
                SalesHeader."Document Type" := OptionIdx;

                Create();
                SetValue('DocumentType', Format(SalesHeader."Document Type"));
            end;
        end;
    end;



Filter by label (Content by label)
showLabelsfalse
showSpacefalse
sorttitle
titleMore examples
excerptTypesimple
cqllabel = "bc" and label = "referencedata" and label = "example" and label = "OnGetReferenceData_OnAddDataTables"

...