Use this event to
Filter Items to be displayed at the mobile device for SearchType = "ItemSearch".
Description
Use this event to modify existing standard Mobile WMS filters for "Item No.", "Description" and "Category" - or implement new filters based on other fields.
Template
[EventSubscriber(ObjectType::Codeunit, Codeunit::"MOB WMS Online Search", 'OnSearchOnItemSearch_OnSetFilterItem', '', true, true)]
local procedure OnSearchOnItemSearch_OnSetFilterItem(var _RequestValues: Record "MOB NS Request Element"; var _Item: Record Item)
begin
end;
Example 01: Change standard Mobile WMS filters
// [Example 01] Change standard Mobile WMS filters
[EventSubscriber(ObjectType::Codeunit, Codeunit::"MOB WMS Online Search", 'OnSearchOnItemSearch_OnSetFilterItem', '', true, true)]
local procedure My01OnSearchOnItemSearch_OnSetFilterItem(var _RequestValues: Record "MOB NS Request Element"; var _Item: Record Item)
var
ItemNo: Text;
ItemDescription: Text;
begin
//
// Change ItemNo filter from start of Item No. to any part of Item No.
//
ItemNo := _RequestValues.GetValue('ItemNo');
if ItemNo <> '' then
_Item.SetFilter("No.", '%1', '*' + ItemNo + '*');
//
// Change Description filter from any part of SearchDescription any part of Description/Description2 (cross-search)
//
ItemDescription := _RequestValues.GetValue('ItemDescription');
if ItemDescription <> '' then begin
_Item.SetRange("Search Description"); // Remove standard Mobile WMS filter
_Item.FilterGroup(-1); // Cross-colum search
_Item.SetFilter(Description, '%1', '@*' + ItemDescription + '*');
_Item.SetFilter("Description 2", '%1', '@*' + ItemDescription + '*');
_Item.FilterGroup(0);
end;
end;
Example 02: Change standard Mobile WMS to include support for typed filters (ie. '2*')
// [Example 02]: Change standard Mobile WMS to include support for typed filters (ie.'2*')
[EventSubscriber(ObjectType::Codeunit, Codeunit::"MOB WMS Online Search", 'OnSearchOnItemSearch_OnSetFilterItem', '', true, true)]
local procedure My02OnSearchOnItemSearch_OnSetFilterItem(var _RequestValues: Record "MOB NS Request Element"; var _Item: Record Item)
var
MobToolbox: Codeunit "MOB Toolbox";
ItemNo: Text;
ItemDescription: Text;
begin
//
// Change standard Mobile WMS filters to support typed filters (ie. '*2')
// ItemCategory filter is excluded here since value is collected from a list
//
ItemNo := _RequestValues.GetValue('ItemNo');
if MobToolbox.IsFilter(ItemNo) then
_Item.SetFilter("No.", ItemNo);
ItemDescription := _RequestValues.GetValue('ItemDescription');
if MobToolbox.IsFilter(ItemDescription) then
_Item.SetFilter("Search Description", ItemDescription);
end;
Example 03: Change ItemNo filter to be any part of "No."/"No. 2" (cross-search) and display "No. 2" in search response
//
// [Example 03]: ItemNo filter as any part of "No."/"No. 2" (cross-search) and display "No. 2" in search response
//
[EventSubscriber(ObjectType::Codeunit, Codeunit::"MOB WMS Online Search", 'OnSearchOnItemSearch_OnSetFilterItem', '', true, true)]
local procedure My03OnSearchOnItemSearch_OnSetFilterItem(var _RequestValues: Record "MOB NS Request Element"; var _Item: Record Item)
var
ItemNo: Text;
begin
// Change ItemNo filter from start of "No." to any part of "No." / "No. 2" (cross-search)
ItemNo := _RequestValues.GetValue('ItemNo');
if ItemNo <> '' then begin
_Item.SetRange("No."); // Remove standard Mobile WMS filter in FilterGroup(0)
_Item.FilterGroup(-1); // Cross-colum search
_Item.SetFilter("No.", '%1', '@*' + ItemNo + '*');
_Item.SetFilter("No. 2", '%1', '@*' + ItemNo + '*');
_Item.FilterGroup(0);
end;
end;
[EventSubscriber(ObjectType::Codeunit, Codeunit::"MOB WMS Online Search", 'OnSearchOnItemSearch_OnAfterSetFromItem', '', true, true)]
local procedure My03OnSearchOnItemSearch_OnAfterSetFromItem(_Item: Record Item; var _SearchResponseElement: Record "MOB NS SearchResult Element")
var
MobToolbox: Codeunit "MOB Toolbox";
begin
// Display "No. 2" as part of DisplayLine1 if populated
if _Item."No. 2" <> '' then
_SearchResponseElement.Set_DisplayLine1(_SearchResponseElement.Get_DisplayLine1() + MobToolbox.CRLFSeparator() + _Item."No. 2");
end;
More examples
There are no items with the selected labels at this time.
Version History
Version | Changes |
---|---|
MOB5.34 | Introduced |