Portal Engine Questions on portal engine and web parts.
Version 4.x > Portal Engine > SelectNodes by document type property View modes: 
User avatar
Member
Member
info@webcoda.com.au - 11/5/2009 5:57:13 AM
   
SelectNodes by document type property
Hi,

I have a custom DocumentType "CmsPage" with property "ShowInTheFooter".
I need to execute the search and load all pages that use my custom DocumentType with this property set to "true".

I could not work out how do you track the relationsip between the CMS_Tree table and CUSTOM_CmsPage table.

Thanks for your help,
Oleg

User avatar
Kentico Developer
Kentico Developer
kentico_martind - 11/9/2009 9:24:10 AM
   
RE:SelectNodes by document type property
Hi Oleg,

You can use following overload of SelectNodes method that allows you to specify class name (document type) and where condition:

ds = tree.SelectNodes("SiteName","/%", "en-us", true, "custom.documentType", "CustomField = 1");

Best Regards,

Martin Dobsicek

User avatar
Member
Member
Webcoda - 11/9/2009 6:26:31 PM
   
RE:SelectNodes by document type property
Thanks for answer.

Also just for a record, the relationship with custom document type table is defined in CMS_Document.DocumentForeignKeyValue field.

So custom proc that would do the same would be

SELECT T.*
P.*
FROM View_CMS_Tree_Joined T
INNER JOIN CUSTOM_DOCTYPE P ON T.DocumentForeignKeyValue = P.[ID]
WHERE T.ClassName = 'CUSTOM.DOCTYPECLASS'
AND P.CUSTOMFIELD = 1

User avatar
Kentico Developer
Kentico Developer
kentico_martind - 11/12/2009 3:55:48 AM
   
RE:SelectNodes by document type property
Hi Oleg,

just FYI, if you want to run custom query to get data of document, you can select them from appropriate view that is created automatically for each document type where appropriate tables are already joined and that contains all necessary data. You can check it's name in SQL Management Studio for appropriate DB. E.g. view for news is called: View_CONTENT_news_Joined

Best Regards,

Martin Dobsicek

User avatar
Member
Member
Webcoda - 11/12/2009 4:01:28 AM
   
RE:SelectNodes by document type property
Thanks Martin,

Yes, this is where I got my query from.