Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Removed helper function because of mob function that does the same

Use this event to

Excerpt
Modify existing response for online search 'BinSearch' (values transferred from "Bin" table).

Template

    [EventSubscriber(ObjectType::Codeunit, Codeunit::"MOB WMS Online Search", 'OnSearchOnBinSearch_OnAfterSetFromBin', '', true, true)]
    localprocedure OnSearchOnBinSearch_OnAfterSetFromBin(_Bin: Record Bin; var _SearchResponseElement: Record"MOB NS WhseInquery SearchResult Element")
    begin
    end;

Example: Display "Qty. Base" on Hand for Bins with content

    // [Example] Display "Qty. Base" on Hand for Bins with content
    [EventSubscriber(ObjectType::Codeunit, Codeunit::"MOB WMS Online Search", 'OnSearchOnBinSearch_OnAfterSetFromBin', '', true, true)]
    localprocedure MyOnSearchOnBinSearch_OnAfterSetFromBin(_Bin: Record Bin; var _SearchResponseElement: Record"MOB NS WhseInquery SearchResult Element")
    var
        WarehouseEntry: Record"Warehouse Entry";
        MobWmsToolbox: Codeunit"MOB WMS Toolbox";
    begin
        if _SearchResponseElement.Get_DisplayLine3() = ''thenbegin// Not having existing text 'Empty'
            WarehouseEntry.SetCurrentKey("Bin Code", "Location Code");
            WarehouseEntry.SetRange("Bin Code", _Bin.Code);
            WarehouseEntry.SetRange("Location Code", _Bin."Location Code");
            WarehouseEntry.CalcSums("Qty. (Base)");

            _SearchResponseElement.Set_DisplayLine3(WarehouseEntry.FieldCaption("Qty. (Base)") + ': ' + DecimalToCultureTextMobWmsToolbox.Decimal2TextAsDisplayFormat(WarehouseEntry."Qty. (Base)", false));
        end;
    end;
    /// <summary>
    /// Convert Decimal to Text in culture format (Mobile user language format)
    /// </summary>    
    local procedure DecimalToCultureText(_Decimal: Decimal; _BlankZero: Boolean): Text
    var
        TypeHelper: Codeunit "Type Helper";
    begin
        if _Decimal = 0 then
            if _BlankZero then
                exit(' ') // Space is intentional
            else
                exit('0');
        // Uses DotNet String.Format. See https://learn.microsoft.com/en-us/dotnet/standard/base-types/custom-numeric-format-strings#SpecifierD
        exit(TypeHelper.FormatDecimal(_Decimal, '0.################', TypeHelper.LanguageIDToCultureName(GlobalLanguage()))); //'0.################' = Any value without 1000-separator, limited to max 16 decimal places
    end;


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

Version History

VersionChanges
MOB5.43Introduced