API
Version 7.x > API > issue with CategoryInfoProvider.GetDocumentCategories View modes: 
User avatar
Member
Member
ap - 4/2/2013 1:35:50 PM
   
issue with CategoryInfoProvider.GetDocumentCategories
hello. when i attempt to use:
CategoryInfoProvider.GetDocumentCategories

such as:

DataSet ds1 = CategoryInfoProvider.GetDocumentCategories("CategoryId=123", null, 0);
OR
DataSet ds1 = CategoryInfoProvider.GetDocumentCategories("CategoryId=123", "", 0);

it throws an error:

[DataConnection.HandleError]: Query: WITH AllData (CategoryID, CategoryDisplayName, CategoryName, CategoryCount, CategoryNamePath, CategoryIDPath, CategoryUserID, CategorySiteID, CategoryParentID)
AS
(
SELECT CMS_Category.CategoryID, CMS_Category.CategoryDisplayName, CMS_Category.CategoryName, count(DocumentID) as CategoryCount, CMS_Category.CategoryNamePath, CMS_Category.CategoryIDPath, CMS_Category.CategoryUserID, CMS_Category.CategorySiteID, CMS_Category.CategoryParentID
FROM CMS_Category INNER JOIN CMS_DocumentCategory ON CMS_Category.CategoryID = CMS_DocumentCategory.CategoryID WHERE (DocumentID IN (SELECT DocumentID FROM View_CMS_Tree_Joined WHERE CategoryID=123
GROUP BY CMS_Category.CategoryID, CMS_Category.CategoryDisplayName, CMS_Category.CategoryName, CMS_Category.CategoryNamePath, CMS_Category.CategoryIDPath, CMS_Category.CategoryUserID, CMS_Category.CategorySiteID, CMS_Category.CategoryParentID
)
SELECT CategoryID, CategoryDisplayName, CategoryName, CategoryCount, CategoryNamePath, CategoryIDPath, CategoryUserID, CategorySiteID, CategoryParentID
FROM AllData AS cats
WHERE NOT EXISTS (SELECT CategoryID FROM AllData WHERE CategoryParentID = cats.CategoryID)
: caused exception: Incorrect syntax near the keyword 'SELECT'.

however if i use:
DataSet ds1 = CategoryInfoProvider.GetDocumentCategories(xNode.DocumentID, "CategoryIDPath LIKE '/00001315/%'", null, 0, "CMS_Category.CategoryID, CategoryIDPath");

it works fine.
Thanks for your help.

User avatar
Kentico Support
Kentico Support
kentico_jurajo - 4/2/2013 4:06:39 PM
   
RE:issue with CategoryInfoProvider.GetDocumentCategories
Hi,

Thank you for letting us know about this issue. Regrettably, this seems to be a bug in the current version. I'm very sorry for this inconvenience. We will try fix it in the next version or in the next hotfix package for this particular Kentico CMS version.

Best regards,
Juraj Ondrus