Use this event to
Excerpt |
---|
Filter Items to be displayed at on the mobile device for SearchType = "ItemSearch". |
Description
Use this event to
- modify existing
...
- filters for "Item No.", "Description" and "Category"
...
- or implement new filters based on other fields.
You can set filters on the "VAR" record parameter to limit the search results.
Template
[EventSubscriber(ObjectType::Codeunit, Codeunit::"MOB WMS Online Search", 'OnSearchOnItemSearch_OnSetFilterItem', '', true, true)]
localprocedure OnSearchOnItemSearch_OnSetFilterItem(var _RequestValues: Record"MOB NS Request Element"; var _Item: Record Item)
begin
end;
Parameters
Expand | ||
---|---|---|
| ||
|
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)]
localprocedure 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 <> ''thenbegin
_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)]
localprocedure 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)]
localprocedure 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 <> ''thenbegin
_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)]
localprocedure 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;
Filter by label (Content by label) showLabels false showSpace false sort title title More examples excerptType simple cql label = "bc" and label = "search" and label = "onsetfilter" and label = "example"
...