Specify key for flowfield

FommoFommo Member Posts: 138
Hi there

I feel kinda stupid, but I can't figure this out.
On the Item card in NAV 4.0SP3 I need to specify the key used for the inventory field. The number is correct, but when the user drills down to the entries behind it gets sorted in the wrong order. The customer wants them to be sorted in chronological order using the database key "Item No., Entry No.".

How can I specify this? There is no property like RunFormView that allows me to specify sorting key.
I know that one possibility is to change primary key, but I guess that would result in a lot of performance issues in other areas depending on the current standard primary key.

Comments

  • Ian_Piddington10199Ian_Piddington10199 Member Posts: 167
    You can modify the sorting on the targe form. if you design the form that you drill into you can then set the SourceTableView property. This should control the sorting for you.

    Ian
    Regards

    Ian
  • FommoFommo Member Posts: 138
    You can modify the sorting on the targe form. if you design the form that you drill into you can then set the SourceTableView property. This should control the sorting for you.
    Ian

    True, I've done that. The problem is that if I specify the key on form Item Ledger Entries I will get serious performance problem when I for example want to view Item Ledger Entries from a production order since it will override the sorting parameter in the call from Production Order card.

    Of course I can copy the form and do a special form just for the item card, but I thought it should be possible to specify it in the call to the form. Maybe it's not then. :roll:
  • mrQQmrQQ Member Posts: 239
    YOU NEVER EVER _EVER_ set fixed sorting order for drill down form! EVER!

    what you can do however, is press F9 on Inventory field on Item form, and write your own drill down trigger, to filter Item Ledger Entries, set custom sort order and show default drill down form.

    like:
    ItemLedgEntry.RESET;
    ItemLedgEntry.SETCURRENTKEY("Item No.", "Entry No."); // you have to have such key, but remember that creating a key in ledger table just for sorting purposes might be an overkill
    ItemLedgEntry.SETRANGE("Item No.", "No.");
    FORM.RUN(0, ItemLedgEntry);
    
  • babbab Member Posts: 65
    In the OnDrillDown trigger you also have to copy the flowfilters
    ItemLedgerEntry.RESET;
    ItemLedgerEntry.SETCURRENTKEY("Item No.", "Posting Date");
    ItemLedgerEntry.SETRANGE("Item No.", "No.");
    IF GETFILTER("Global Dimension 1 Filter") <> '' THEN
      ItemLedgerEntry.SETFILTER("Global Dimension 1 Code", GETFILTER("Global Dimension 1 Filter"));
    IF GETFILTER("Global Dimension 2 Filter") <> '' THEN
      ItemLedgerEntry.SETFILTER("Global Dimension 2 Code", GETFILTER("Global Dimension 2 Filter"));
    IF GETFILTER("Location Filter") <> '' THEN
      ItemLedgerEntry.SETFILTER("Location Code", GETFILTER("Location Filter"));
    IF GETFILTER("Drop Shipment Filter") <> '' THEN
      ItemLedgerEntry.SETFILTER("Drop Shipment", GETFILTER("Drop Shipment Filter"));
    IF GETFILTER("Variant Filter") <> '' THEN
      ItemLedgerEntry.SETFILTER("Variant Code", GETFILTER("Variant Filter"));
    IF GETFILTER("Lot No. Filter") <> '' THEN
      ItemLedgerEntry.SETFILTER("Lot No.", GETFILTER("Lot No. Filter"));
    IF GETFILTER("Serial No. Filter") <> '' THEN
      ItemLedgerEntry.SETFILTER("Serial No.", GETFILTER("Serial No. Filter"));
    FORM.RUNMODAL(0, ItemLedgerEntry);
    
  • FommoFommo Member Posts: 138
    Thanks a lot
    Works like a charm... 8)
  • mrQQmrQQ Member Posts: 239
    and i think COPYFILTER would be a tad cleaner aswell.. :)
Sign In or Register to comment.