Desktop version

Main > Forum > 1C:Enterprise Platform > 1C:Enterprise – Business applications platform > How to delete catalog items using Data Processor

Forum

Search UsersRules
How to delete catalog items using Data Processor
#1
Interested
Points:: 0
Joined:: Nov 10, 2011

I imported about 6000 items from am excel sheet into one catalog. Now I want to delete them from the list, but every time I am trying to mark all items at once, the system asks me something like:

1000 rows selected. Continue? If I press ok, it lasts very long. So I have to click "no" and next time select the next 1000 rows again. If I show this solution my customer, he will not like it at all.

So I think if I make it using data processor it will be better. But I have no idea how shoud I implement it (write code).

Could somebody help me?

Thanks in advance!

Profile
#2
Guest
Points::
Joined::

Hello, Lioudmila!

You need to create a query with result processing, get object and set deletion mark for this item or delete directly. You can right-click somewhere in the module and select this option from the context menu.

Code
   Query = New Query;
   Query.Text = 
      "SELECT
      |   Items.Ref
      |FROM
      |   Catalog.Items AS Items
      |WHERE
      |   NOT Items.DeletionMark";
   
   QueryResult = Query.Execute();
   
   SelectionDetailRecords = QueryResult.Select();
   
   While SelectionDetailRecords.Next() Do
      CurObject = SelectionDetailRecords.Ref.GetObject();
      CurObject.DeletionMark = True;
      CurObject.Write();
      // CurObject.Delete(); // Dangerous
   EndDo;

Profile
#3
Interested
Points:: 0
Joined:: Nov 10, 2011

Thanks a lot, Timofey! It was really very easy and it works! :)

Profile
Subscribe
Users browsing this topic (guests: 1, registered: 0, hidden: 0)



© 1C LLC. All rights reserved
1C Company respects the privacy of our customers and visitors
to our Web-site.