Versions Compared

Key

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

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

Use this event to

Excerpt

Add

...

Description

When a template is printed you can have additional values collected using Steps.

New steps can be added or existing ones changed.

 

Template

new steps to label template


  

  • A template will not be shown unless at least one step has been added
  • You may use this event to add steps shown to the user
  • This event is executed once per mobile report

Image Added Image Added Image Added Image Added


See also: 

Standard Label Template Designs

OnLookupOnPrintLabel_OnAfterAddStepForTemplate


Template

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


Expand
titleClick here for parameters...
  • _TemplateName: 
    • Name of the template to handle
  • _SourceRecRef: 
    • A RecordRef to the context the print is called from.
    • I.e. Sales Order Line, Warehouse Receipt Line, Purchase Order Return Line, Warehouse Activity(Pick, Put-away) etc.
  • _Steps:
    • The steps you want to collect
  • _Dataset: 
    • The Print Dataset . Use the dataset and determine which steps you want to collect


Example 1: Collect additional steps

...

    [EventSubscriber(ObjectType::CodeunitCodeunit::"MOB Print", 'OnLookupOnPrintLabel_OnAddStepsForTemplate''', true, true)]
    local procedure

...

 My01OnLookupOnPrintLabel_OnAddStepsForTemplate(_TemplateName: Text[50]; _SourceRecRef: RecordRefvar _Steps: Record "MOB Steps Element"; var _Dataset: Record "MOB Common Element")
    var
        Item: Record Item;
    begin

...

        // Making sure we only handle our own Label-Template
        if _TemplateName <> 'My custom Label-Template' then
            exit;

        // Collect additional Steps

        //

...

 If ItemNo is already collected/transferred to Dataset display the item information, otherwise collect ItemNumber
        if Item.Get(_Dataset.GetValue('ItemNo')) then
            

...

_Steps.Create_InformationStep(10'InfoStep''Information''''You are printing with Item:' + Item."No.")
        else
            

...

_Steps.Create_TextStep_ItemNumber(10);

        //

...

 Collect which printer to print to and number of labels
        _Steps.Create_ListStep_Printer(80, CopyStr(_TemplateName, 150));
        

...

_Steps.Create_

...

IntegerStep_

...

NoOfCopies(90);
    end;


Example 02: Reading values the context/source record (Purchase Line)

You can use the Source Record to determine which steps to collect, setting default values etc.

     // [Example 02] Reading values the context/source record (Purchase Line)
    // You can use the Source Record to determine which steps to collect, setting default values etc.
    [EventSubscriber(ObjectType::CodeunitCodeunit::"MOB Print", 'OnLookupOnPrintLabel_OnAddStepsForTemplate''', true, true)]
    local procedure

...

 My02OnLookupOnPrintLabel_OnAddStepsForTemplate(_TemplateName: Text[50]; _SourceRecRef: RecordRefvar _Steps: Record "MOB Steps Element"; var _Dataset: Record "MOB Common Element")
    var
        Item: Record Item;
        PurchaseLine: Record "Purchase Line";
    begin

...

        // Making sure the source table is one we can handle
        if _SourceRecRef.Number() <> Database::"Purchase Line" then
            exit;

        // Use RecordRef to get the actual source record
        _SourceRecRef.SetTable(PurchaseLine);
        PurchaseLine.SetView(_SourceRecRef.GetView());

        // Get Item and show an information step
        if PurchaseLine.Type = PurchaseLine.Type::Item then begin

...

            Item.Get(PurchaseLine."No.");

...


            _Steps.Create_InformationStep(10'InfoStep''Information''''You are printing with Item:' + Item."No.")
        end;
    end;


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

  


Version History

VersionChanges
MOB5.16Introduced

...

Label Templates

Child pages (Children Display)
pageLabel Templates

Templates Handlers

...