Site structure
Version 4.x > Site structure > Custom document structure, linking two documents. View modes: 
User avatar
Member
Member
bluerhino_avanmeter - 6/29/2009 5:52:22 PM
   
Custom document structure, linking two documents.
I'm creating a section that has a 2-layer document structure:

Category 1
Item 1
Item 2
Category 2
Item 1
Category 3
Item 1
Item 2
Item 3


I've created a custom document type for each layer, TestCategory and TestItem. When a user is adding an Item, I allow them to select a TestCategory which the TestItem should fall under, using the "Drop-down list" field type. I'm populating that list using the SQL query:

SELECT TestCategoryID as value, TestCategoryName as text
FROM bluerhino_BRProductCategory
ORDER BY ProductCategory


The TestCategoryID is stored in the TestItem's table, but I'd like to also be able to access the TestCategoryName (for display purposes) on the TestItem pages.

I thought that I could manually change the View_bluerhino_TestItem_Joined view and add a inner join to the TestCategory table on the category ID's and pull in TestCategoryName to the result set. I did that, and selecting from that view in SQL manager works fine.

However, when I tried to code it on a TestItem page, the CMSContext.CurrentDocument.DataRow does not have a TestCategoryName column.

Does CMSContext.CurrentDocument not get filled by the "selectdocuments" query, or am I doing something else wrong?

User avatar
Kentico Developer
Kentico Developer
kentico_martind - 7/11/2009 1:11:58 PM
   
RE:Custom document structure, linking two documents.
Hello,

Unfortunately, CMSContext.CurrentDocument.DataRow doesn't contain custom fields. Could you please use query repeater with simple transformation instead to display value from 'TestCategoryName' field on page?

Best Regards,

Martin Dobsicek