Versions Compared

Key

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

Description

...

When working with custom sorting, you will need to consider whether orders should still be "grouped" or can now be mixed across the four document sources.

...


Example: Existing fields

  • Change key to existing field "Item no."
  • Change sorting direction to "Descending"

For this task you can must use an OnAfterSetCurrentKey event.


[EventSubscriber(ObjectType::CodeunitCodeunit::"MOB WMS Receive", 'OnGetReceiveOrders_OnAfterSetCurrentKey''', true, true)]
procedure OnGetReceiveOrders_OnAfterSetCurrentKey(var _BaseOrderElementView: Record "MOB Ns BaseDataModel Element")
begin
     _BaseOrderElementView.SetCurrentKey(BackendID);
     _BaseOrderElementView.Ascending(true);
end;




Example: Custom fields

  • Sort lines by you own custom field

For this task you must use the OnAfterSetFrom.


[EventSubscriber(ObjectType::CodeunitCodeunit::"MOB WMS Receive", 'OnGetReceiveOrderLines_OnAfterSetFromAnyLine''', true, true)]
procedure OnGetReceiveOrderLines_OnAfterSetFromAnyLine(_RecRef: RecordRefvar _BaseOrderLineElement: Record "MOB Ns BaseDataModel Element")
var
     Item: Record Item;
begin
     with _LineElement do begin
          // New custom tag
          Item.Get(Get_ItemNumber());
          SetValue('SpecialEquimentCode', Item."Special Equipment Code");

          // Sort by custom tag
          Set_Sorting1(GetValue('SpecialEquimentCode'));
     end;
end



TODO – Keywords:

OnAfterSetCurrentKey:

...