Use this event to
Change sort order for the OrderLinesList at the mobile device.
Description
You may use this event only to change sort order of the OrderLinesList-elements displayed at the mobile device. You cannot set any values from this event.
The OrderLinesList for Assembly Orders includes in the same list a single (topmost) element representing 'Output', and multiple indented elements representing 'Consumption'.
When customizing the sortorder, this structure should be maintained. The example at the end of this article shows a way to do this (by taking advantage of the fact that topmost-element and indented elements are derived from different tables Assembly Header and Assembly Lines and has distinct OnAfterSetFrom-events).
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).
- Use
Change sorting direction
- Use
.Ascending(true/false)
-function.
- Use
Sorting by custom fields
Change sorting key
- Not possible from this event. Use OnGetAssemblyOrderLines_OnAfterSetFromAssemblyLine with the
Set_Sorting1()-
function instead.
- Not possible from this event. Use OnGetAssemblyOrderLines_OnAfterSetFromAssemblyLine with the
Change sorting direction
- This requires two steps for custom fields:
- Use OnGetAssemblyOrderLines_OnAfterSetFromAssemblyLine with
Set_Sorting1()
-function as described above. - Then use
.Ascending()
-function in this event.
Template
[EventSubscriber(ObjectType::Codeunit, Codeunit::"MOB WMS Assembly", 'OnGetAssemblyOrderLines_OnAfterSetCurrentKey', '', true, true)]
local procedure OnGetAssemblyOrderLines_OnAfterSetCurrentKey(var _BaseOrderLineElementView: Record "MOB Ns BaseDataModel Element")
begin
end;
Example
// [Example] Change sorting to Unit Of Measure, then Item Number BUT ensure 'Output' (Assembly Header) is still displayed prior to 'Consumption' (Assembly Lines)
[EventSubscriber(ObjectType::Codeunit, Codeunit::"MOB WMS Assembly", 'OnGetAssemblyOrderLines_OnAfterSetCurrentKey', '', true, true)]
local procedure MyOnGetAssemblyOrderLines_OnAfterSetCurrentKey(var _BaseOrderLineElementView: Record "MOB Ns BaseDataModel Element")
begin
_BaseOrderLineElementView.SetCurrentKey("Sorting1 (internal)", UnitOfMeasure, ItemNumber);
_BaseOrderLineElementView.Ascending(true);
end;
[EventSubscriber(ObjectType::Codeunit, Codeunit::"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::Codeunit, Codeunit::"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;
More examples
There are no items with the selected labels at this time.
Version History
Version | Changes |
---|---|
MOB5.24 | Introduced |