Deleting the Items which does not have any Transactions

haseeb1812
Member Posts: 8
Hi,
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:
item.reset;
if item.findset then repeat
itemledgentry.reset;
itemledgentry.setrange("Item No.",Item."No.");
if not itemledgentry.findfirst then
item.delete(true);
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()
Item.Delete(True);
is also not skipping the Item Ledger Entry records.
Kindly help me...
Thank you.
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:
item.reset;
if item.findset then repeat
itemledgentry.reset;
itemledgentry.setrange("Item No.",Item."No.");
if not itemledgentry.findfirst then
item.delete(true);
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()
Item.Delete(True);
is also not skipping the Item Ledger Entry records.
Kindly help me...
Thank you.
0
Comments
-
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.0 -
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.0 -
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 Haseeb0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions