Versions Compared

Key

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

Use this event to

Excerpt

Filter Items to be displayed at on the mobile device for SearchType = "ItemSearch".

Description

This event affects locations with Location."Bin Mandatory" = trueUse 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 LookupOnline Search", 'OnLookupOnBinContentOnSearchOnItemSearch_OnSetFilterBinContentOnSetFilterItem', '', true, true)]
    localprocedure OnLookupOnBinContent OnSearchOnItemSearch_OnSetFilterBinContentOnSetFilterItem(var _RequestValues: Record"MOB NS Request Element"; var _BinContentItem: Record "Bin Content" Item)
    begin
    end;

...


 

Parameters

Expand
titleClick here for parameters...
  • _RequestValues: Request values, including header fields. Use GetValue() to read the request
  • _Item: Set filters on this "VAR" record to limit the search results


Example 01: Change standard Mobile WMS filters

    // [Example 01] Include all Bin Content (remove "Quantity<>0" condition)Change standard Mobile WMS filters
    [EventSubscriber(ObjectType::Codeunit, Codeunit::"MOB WMS LookupOnline Search", 'OnLookupOnBinContentOnSearchOnItemSearch_OnSetFilterBinContentOnSetFilterItem', '', true, true)]
    localprocedure My01OnLookupOnBinContent My01OnSearchOnItemSearch_OnSetFilterBinContentOnSetFilterItem(var _RequestValues: Record"MOB NS Request Element"; var _BinContent: Record "Bin Content")
    begin
        _BinContent.SetRange(Quantity); // Include all Bin Content records regardless of Quantity on handItem: 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]:  Combination of OnSetFilter and OnInclude -events. Display all fixed bins, but only floating bins with inventoryChange standard Mobile WMS to include support for typed filters (ie.'2*')
    [EventSubscriber(ObjectType::Codeunit, Codeunit::"MOB WMS LookupOnline Search", 'OnLookupOnBinContentOnSearchOnItemSearch_OnSetFilterBinContentOnSetFilterItem', '', true, true)]
    localprocedure My02OnLookupOnBinContent My02OnSearchOnItemSearch_OnSetFilterBinContentOnSetFilterItem(var _RequestValues: Record"MOB NS Request Element"; var _BinContent: Record "Bin Content")
    beginItem: 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
            _BinContentItem.SetRange(Quantity); // Include all Bin Content records regardless of Quantity on hand
    end;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 LookupOnline Search", 'OnLookupOnBinContentOnSearchOnItemSearch_OnIncludeBinContentOnSetFilterItem', '', true, true)]
    localprocedure My02OnLookupOnBinContent My03OnSearchOnItemSearch_OnIncludeBinContentOnSetFilterItem(var _BinContentRequestValues: Record"Bin ContentMOB NS Request Element"; var _IncludeInLookupItem: Boolean)Record Item)
    var
        ItemNo: Text;
    begin
        _IncludeInLookup := _IncludeInLookup and ((_BinContent.Quantity <> 0) or _BinContent.Fixed);   // Exclude floating bins with no inventory// 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)
showLabelsfalse
showSpacefalse
sorttitle
titleMore examples
excerptTypesimple
cqllabel = "bc" and label = "lookup" and label = "bincontentsearch" and label = "onsetfilter" and label = "example"


Version History

Version

Changes

MOB5.
34
43Introduced