Versions Compared

Key

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


This article requires
Note
Info
titleRequirement

Mobile WMS Extension version 5MOB5.16 or later.

Description

Excerpt

Modify collected steps before a Label-template is printed.

...

This approach works for all templates, standard or custom.


Add a Step and remove a Step

In the following example we will be:

...

    [EventSubscriber(ObjectType::CodeunitCodeunit::"MOB Print", 'OnLookupOnPrintLabel_OnAddStepsForTemplate''', true, true)]
    local procedure MyOnLookupOnPrintLabel_OnAddStepsForTemplate(_TemplateName: Text[50]; var _Steps: Record "MOB Steps Element"; var _Dataset: Record "MOB Common Element")
    var
        Item: Record Item;
    begin

        // Make sure we only handle our own Label-Template
        if _TemplateName <> 'MyItemLabel' then
            exit;

        // Check if Item No. is already collected/transferred to Dataset
        if Item.Get(_Dataset.GetValue('ItemNumber')) then
            // Add an information step using the Item no.
            _Steps.Create_InformationStep(10'InfoStep''Information''''You are printing with Item:' + Item."No.");

        // Delete the unwanted Quantity-step
        _Steps.SetRange(name, 'QuantityPerLabel');
        if _Steps.FindFirst() then
            _Steps.Set_visible(false);
        _Steps.SetRange(name)// Reset the filter so the next event is not affected by you
    end;

Inspect the functionality

Your device should look this this.


Modify the behavior of the Template Handler further

...