Deleting the Items which does not have any Transactions

haseeb1812haseeb1812 Member Posts: 8
I am new to Navision / LS Retail we have classic client 2009 sp2.
I need a help ,in deleting items (almost 50,000) which does not have any transaction entry in Item Legder entry table
I tried it with two ways,

1.I Created a Code unit,

On Run Code:
if item.findset then repeat
itemledgentry.setrange("Item No.",Item."No.");
if not itemledgentry.findfirst then
until item.next = 0;

Running this code unit is not skipping the records in Item ledger entry.

2.Created a report with data item ITEM Table

required filters : Date created,Inventory=0,Purcase qty =0,Sales qty =0,Division=value.
On aftergetrecord()

is also not skipping the Item Ledger Entry records.

Kindly help me...

Thank you.


  • Options
    SavatageSavatage Member Posts: 7,142
    What we did was add a new field to the item table called "Ledger Entry Exists"
    Type Boolean.
    FieldClass = Flowfield
    Calcformula = Exist("Item Ledger Entry" WHERE (Item No.=FIELD(No.)))

    Then we can filter on the items that do not have this field checked.
    Select & delete - letting the item table (onDelete) take care of the rest.
  • Options
    haseeb1812haseeb1812 Member Posts: 8
    Thank you Harry.

    I will try to do as suggested.

    But will it create Preaction as I need to maintain same data at stores as well.
  • Options
    haseeb1812haseeb1812 Member Posts: 8
    Thank You Harry

    I tried your suggestion ,It is working fine but taking almost 5 minutes to delete one single Item.
    I have 50,000 Items to delete it will take long time.

    So kindly suggest accordingly.

    Best Regards
    Abdul Haseeb
Sign In or Register to comment.