Versions Compared

Key

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

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

Use this event to

Excerpt

Change sort order for Consumption Lines at the mobile device. 



Description

You may use this event only to change sort order of the Consumption Lines displayed at the mobile device. You cannot set any values from this event.


Sorting by existing fields

  • Change sorting key
    • Use .SetCurrentKey(field)-function with any of the existing fields from the Line table (Record parameter on this event).

  • Change sorting direction
    • Use .Ascending(true/false)-function. 

Sorting by custom fields

  • Change sorting key 
  • Change sorting direction
    • This requires two steps for custom fields:
    1. Use WIP Assembly OnGetProdConsumptionLinesOnGetAssemblyOrderLines_OnAfterSetFromProdOrderComponentOnAfterSetFromAssemblyLine with Set_Sorting1()-function as described above.
    2. Then use .Ascending()-function in this event.


Template

    [EventSubscriber(ObjectType::CodeunitCodeunit::"MOB WMS Production ConsumptionMOB WMS Assembly", 'OnGetProdConsumptionLinesOnGetAssemblyOrderLines_OnAfterSetCurrentKey''', true, true)]
    local procedure OnGetProdConsumptionLines OnGetAssemblyOrderLines_OnAfterSetCurrentKey(var _BaseOrderLineElementView: Record "MOB Ns BaseDataModel Element")
    begin
    end;

Example

    // [Example]  Change sorting to Unit Of Measure, then Item Number then Item Number BUT ensure 'Output' (Assembly Header) is still displayed prior to 'Consumption' (Assembly Lines)
    [EventSubscriber(ObjectType::CodeunitCodeunit::"MOB WMS Production ConsumptionMOB WMS Assembly", 'OnGetProdConsumptionLinesOnGetAssemblyOrderLines_OnAfterSetCurrentKey''', true, true)]
    local procedure MyOnGetProdConsumptionLines MyOnGetAssemblyOrderLines_OnAfterSetCurrentKey(var _BaseOrderLineElementView: Record "MOB Ns BaseDataModel Element")
    begin
        _BaseOrderLineElementView.SetCurrentKey(UnitOfMeasure("Sorting1 (internal)", UnitOfMeasure, ItemNumber);
        _BaseOrderLineElementView.Ascending(true);
    end;

    [EventSubscriber(ObjectType::CodeunitCodeunit::"MOB WMS Assembly", 'OnGetAssemblyOrderLines_OnAfterSetFromAssemblyHeader''', true, true)]
    local procedure OnGetAssemblyOrderLines_OnAfterSetFromAssemblyHeader(_AssemblyHeader: Record "Assembly Header"; var _BaseOrderLineElement: Record "MOB Ns BaseDataModel Element")
    begin
        _BaseOrderLineElement."Sorting1 (internal)" := Format(Database::"Assembly Header")// '900'  (sort before '901')
    end;

    [EventSubscriber(ObjectType::CodeunitCodeunit::"MOB WMS Assembly", 'OnGetAssemblyOrderLines_OnAfterSetFromAssemblyLine''', true, true)]
    local procedure OnGetAssemblyOrderLines_OnAfterSetFromAssemblyLine(_AssemblyLine: Record "Assembly Line"; _TrackingSpecification: Record "Tracking Specification"; var _BaseOrderLineElement: Record "MOB Ns BaseDataModel Element")
    begin
        _BaseOrderLineElement."Sorting1 (internal)" := Format(Database::"Assembly Line")// '901'  (sort after '900')
    end;



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

  

Version History

VersionChanges
MOB5.2224Introduced