Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 18 Next »

Deprecated since MOB5.14

Consider using the OnGetReferenceData_OnAddRegistrationCollectorConfigurations event instead if you are using MOB5.14 or newer.


Use this event to

Create new Configuration Key in ReferenceData with associated "registrationCollectorConfiguration" CDATA Value-section.


Description

Input is XmlReponse with standard Mobile WMS registrationCollectorConfiguration's already written to the Xml.  Addtional elements can be added directly to the response.


Template

    [EventSubscriber(ObjectType::CodeunitCodeunit::"MOB WMS Reference Data", 'OnGetReferenceData_OnAfterAddRegistrationCollectorConfigurationsAsXml''', true, true)]
    local procedure OnGetReferenceData_OnAfterAddRegistrationCollectorConfigurationsAsXml(var _XmlResponseData: XmlNode)
    var
        MobXmlMgt: Codeunit "MOB XML Management";
        XmlConfigurationNode: XmlNode;
        XmlKeyNode: XmlNode;
        XmlValueNode: XmlNode;
        XmlCDataSection: XmlCdata;
    begin

        // Add the mandatory nodes
        MobXmlMgt.AddElement(_XmlResponseData, 'Configuration''''', XmlConfigurationNode);
        MobXmlMgt.AddElement(XmlConfigurationNode, 'Key''CustomOrderLineExtraInfo''', XmlKeyNode);
        MobXmlMgt.AddElement(XmlConfigurationNode, 'Value''''', XmlValueNode);

        // Add the CDATA section to the Value-Node
        XmlCDataSection := MyGetCDataSection();
        MobXMLMgt.NodeAppendCData(XmlValueNode, XmlCDataSection);
    end;

    local procedure MyGetCDataSection() XmlCDataSection: XmlCdata
    var
        MobXmlMgt: Codeunit "MOB XML Management";
        DummyXmlDocument: XmlDocument;
    begin
        // Create an empty CDATA section to add the registrationCollectorConfiguration XML to
        MobXmlMgt.NodeCreateCData(DummyXmlDocument, XmlCDataSection, '');

        // Create the start tags of the configuration xml. These must be closed afterwards.
        MobXMLMgt.NodeAppendCDataText(XmlCDataSection, '<registrationCollectorConfiguration>');
        MobXMLMgt.NodeAppendCDataText(XmlCDataSection, '<steps>');

        //
        // Add the actual steps
        //

        // ... 
        // ... 

        MobXMLMgt.NodeAppendCDataText(XmlCDataSection, '</steps>');
        MobXMLMgt.NodeAppendCDataText(XmlCDataSection, '</registrationCollectorConfiguration>');

        exit(XmlCDataSection);
    end;


Example

[EventSubscriber(ObjectType::Codeunit, Codeunit::"MOB WMS Reference Data", 'OnGetReferenceData_OnAfterAddRegistrationCollectorConfigurationsAsXml', '', true, true)]
local procedure OnGetReferenceData_OnAfterAddRegistrationCollectorConfigurationsAsXml(var _XmlResponseData: XmlNode)
var
     MobXmlMgt: Codeunit "MOB XML Management";
     XmlConfigurationNode: XmlNode;
     XmlKeyNode: XmlNode;
     XmlValueNode: XmlNode;
     XmlCDataSection: XmlCdata;
begin

     // Add the mandatory nodes
     MobXmlMgt.AddElement(_XmlResponseData, 'Configuration', '', '', XmlConfigurationNode);
     MobXmlMgt.AddElement(XmlConfigurationNode, 'Key', 'CustomOrderLineExtraInfo', '', XmlKeyNode);
     MobXmlMgt.AddElement(XmlConfigurationNode, 'Value', '', '', XmlValueNode);


     // Add the CDATA section to the Value-Node
     XmlCDataSection := GetOrderLineExtraInfoCDataSection();
     MobXMLMgt.NodeAppendCData(XmlValueNode, XmlCDataSection);
end;

/// <summary>
/// This is an example of how to create an extra step for an order line.
/// The MobConfTools codeunit contains helper functions to create all step types available on the mobile device
/// Each function comes in two variants "_CData" and "_XmlNode". When the step configuration is sent out as reference data the
/// _CData version must be used. The _XmlNode version is used when the configuration is not stored in the local database on the
/// mobile device
/// </summary>
local procedure GetOrderLineExtraInfoCDataSection() XmlCDataSection: XmlCdata
var
     MobXmlMgt: Codeunit "MOB XML Management";
     MobConfTools: Codeunit "MOB WMS Conf. Tools";
     DummyXmlDocument: XmlDocument;
begin
     // Create an empty CDATA section to add the registrationCollectorConfiguration XML to
     MobXmlMgt.NodeCreateCData(DummyXmlDocument, XmlCDataSection, '');

     // Create the start tags of the configuration xml. These must be closed afterwards.
     MobXMLMgt.NodeAppendCDataText(XmlCDataSection, '<registrationCollectorConfiguration>');
     MobXMLMgt.NodeAppendCDataText(XmlCDataSection, '<steps>');

     // Add the actual steps
     MobConfTools.RC_Std_Parms(1, 'Demo', 'Demo Header', 'Demo:', 'Demo');
     MobConfTools.RC_Decimal_CData(XmlCDataSection, 0, 0, 0, 3, true);

     MobXMLMgt.NodeAppendCDataText(XmlCDataSection, '</steps>');
     MobXMLMgt.NodeAppendCDataText(XmlCDataSection, '</registrationCollectorConfiguration>');

     exit(XmlCDataSection);
end;


More examples

There are no items with the selected labels at this time.

Version History

VersionChanges
MOB5.00Introduced
  • No labels