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 21 Next »

This article requires Mobile WMS Extension version 5.16 or later.

Description

Modify collected steps before a Label-template is printed.

  • You are not happy with the steps being collected as default by a template handler.
  • Or you have created a custom Template and want to add some steps to collect information used on the printed label.

This approach works for all templates, standard or custom.


Add a Step and remove a Step

In the following example we will be:

  • Making sure we are only handling our own template.
  • Adding an Information Step
  • Removing an unwanted step 

Using the event OnLookupOnPrintLabel_OnAddStepsForTemplate


    [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



More examples




  • No labels