- Created by Johannes Sebastian Nielsen, last modified on Mar 27, 2020
You are viewing an old version of this page. View the current version.
Compare with Current View Page History
« Previous Version 17 Next »
Use this event to
Modify the Dataset after it has been populated with context and collected step values
Description
Should you want to modify the data of a label template (standard or custom) you can do it with this event.
- Make sure you are only handling the desired template.
- Use GetValue/SetValue to modify the dataset.
- All the values in the dataset are sent to InterForm by default.
Please inspect the Label Templates for available fields and labels to modify.
Template
[EventSubscriber(ObjectType::Codeunit, Codeunit::"MOB Print", 'OnPrintLabel_OnAfterPopulateDataset', '', true, true)]
procedure OnPrintLabel_OnAfterPopulateDataset(_TemplateName: Text; _SourceRecRef: RecordRef; var _Dataset: Record "MOB Common Element" temporary)
begin
end;
Example 01 : Change "ItemNumber" in Dataset to a custom value
[EventSubscriber(ObjectType::Codeunit, Codeunit::"MOB Print", 'OnPrintLabel_OnAfterPopulateDataset', '', true, true)]
procedure Ex01OnPrintLabel_OnAfterPopulateDataset(_TemplateName: Text[50]; _SourceRecRef: RecordRef; var _Dataset: Record "MOB Common Element")
begin
// Making sure we only handle our own Label-Template
if _TemplateName <> 'My custom Label-Template' then
exit;
// Read the Item No. from Dataset and change it
// Item No. could have been collected or transferred from ”context”/source table, where the print action was selected by the user
if _Dataset.GetValue('ItemNumber') = 'ItemA' then
_Dataset.SetValue('ItemNumber', 'ItemB');
end;
Example 02: Change some labels
[EventSubscriber(ObjectType::Codeunit, Codeunit::"MOB Print", 'OnPrintLabel_OnAfterPopulateDataset', '', true, true)]
procedure Ex02OnPrintLabel_OnAfterPopulateDataset(_TemplateName: Text[50]; _SourceRecRef: RecordRef; var _Dataset: Record "MOB Common Element")
begin
// Making sure we only handle our own Label-Template
if _TemplateName <> 'My custom Label-Template' then
exit;
// Change the some labels
_Dataset.SetValue('UnitOfMeasure_Label', 'Units');
_Dataset.SetValue('LotNumber_Label', 'Batch No. ');
end;
Example 03: Set extra info fields and their labels
[EventSubscriber(ObjectType::Codeunit, Codeunit::"MOB Print", 'OnPrintLabel_OnAfterPopulateDataset', '', true, true)]
procedure Ex03OnPrintLabel_OnAfterPopulateDataset(_TemplateName: Text[50]; _SourceRecRef: RecordRef; var _Dataset: Record "MOB Common Element")
begin
// Making sure we only handle our own Label-Template
if _TemplateName <> 'My custom Label-Template' then
exit;
// Set extra info fields and their labels
_Dataset.SetValue('ExtraInfo01', 'ExtraInfo01_Value');
_Dataset.SetValue('ExtraInfo01_Label', 'ExtraInfo01_Label');
_Dataset.SetValue('ExtraInfo02', 'ExtraInfo02_Value');
_Dataset.SetValue('ExtraInfo02_Label', 'ExtraInfo02_Label');
_Dataset.SetValue('ExtraInfo03', 'ExtraInfo03_Value');
_Dataset.SetValue('ExtraInfo03_Label', 'ExtraInfo03_Label');
_Dataset.SetValue('ExtraInfo04', 'ExtraInfo04_Value');
_Dataset.SetValue('ExtraInfo04_Label', 'ExtraInfo04_Label');
end;
More examples
-
Page:(Legacy) Case: Print muliple labels with unique lot numbers (MOB5.23-MOB5.38) — Option to generate and print multiple unique labels
-
Page:Case: Print Customized License Plate Contents label (Cloud Print) — Modify the column and lines on License Plate Contents.
-
Page:Case: Print Label on Planned Function Posting (Cloud Print) — Print Label on Planned Posting, i.e. Receive, Pick, Put-away, Ship, Move etc.
-
Page:Case: Print Label on Tote Shipping Posting (Cloud Print) — Print Label on the posting of Tote Shipping.
-
Page:Case: Print muliple labels with unique lot numbers (Cloud Print) — Option to generate and print multiple unique labels
-
Page:Case: Print your own ZPL labels (Cloud Print) — Print your own ZPL labels
-
Page:Cloud Print: How to Copy a Label-Template to New — In this video, we will make a copy an existing label-template
-
Page:Cloud Print: How to modify label-template — In this video, you will be introduced to modify the design of a label-template, using the designer.
-
Page:Cloud Print: How to modify label-template and add data — In this video, you will be introduced to modifying the design of a label template, using the designer, and adding data using AL code.
-
Page:How-to: Add data to label-template (Cloud Print) — You want to modify a label template by adding data to it
-
Page:How-to: Add new/Copy a label-template (Cloud Print) — You want to add/create a custom label template with a unique design
-
Page:How-to: Modify steps on a label-template (Cloud Print) — Modify collected steps before a Label-template is printed.
Version History
Version | Changes |
---|---|
MOB5.16 | Introduced |
Label Templates
Templates Handlers
- No labels