A category cannot be removed if there are existing child items

  • 8 March 2016
  • 1 reply
  • 11 views

Badge +1

I am trying to clean up old K2 objects that aren't being used anymore and I am running into this error when trying to remove a category:

 

A category cannot be removed if there are existing child items. Delete or move all items in this category before removing the category. 

 

15303iB0033301AAE73676.png

 

I am guessing that there are orphaned views or forms or smart objects.  How can I find and destory these?

 

Thank you!


1 reply

Userlevel 5
Badge +16

Hi,

 

Please do the following on the SQL mngr:

 

 

SELECT * FROM [K2].[Category].[Category]
WHERE [DisplayName] like 'CategoryName'

 

 

Get the ID from the previous query.

 

 

SELECT * FROM [K2].[Category].[Data]
WHERE [CategoryId] = the returned ID from the previous query

 

 

You will see the items in this category (i.e "item1"). If you don't see any item, go ahead and delete the category manually from the table. Otherwise:

 

We need to make sure that the items in this category do not exist using the following query for each item.

 

 

For views:

SELECT * FROM [K2].[Form].[View] WHERE [Name] = 'ViewName'

For forms:

SELECT * FROM [K2].[Form].[Form] WHERE [Name] = 'FormName'

if the result is zero(not items), delete the category from the [Category].[Category] table.

 

wish this helps

Reply