Kentico 9 hierarchical viewer and repeater doesn't resolve difference columns for different pages

Andrew Huchko asked on October 13, 2016 16:45

I added repeater to web part zone. In page types I added two pages(CMS.MenuItem, Custom_page - custom page). After thet in columns I added specific column names from each page types. After that kentico doesn't reolve columns which isn't in one of the table.

For ex: Custom_page has column: HelloWorld. This column exist in Custom_page but doesn't in CMS.MenuItem. So after saving it shows server error: invalid column name 'HelloWorld'.

In kentico debug => sqlqueries, I noticed that it inserts both columns in both queries:

SELECT * FROM ( ( SELECT [NodeLinkedNodeSiteID], [NodeSiteID], [NodeAliasPath], [HelloWorld] //etc.. for CMS.MenuItem )

UNION ALL ( SELECT [NodeLinkedNodeSiteID], [NodeSiteID], [NodeAliasPath], [HelloWorld] //etc.. for Custom_page )

) AS SubData

but in proper variant it should be like:

SELECT * FROM ( ( SELECT [NodeLinkedNodeSiteID], [NodeSiteID], [NodeAliasPath], [Custom_page ] //etc.. for CMS.MenuItem )

UNION ALL ( SELECT [NodeLinkedNodeSiteID], [NodeSiteID], [NodeAliasPath], NULL AS [Custom_page ] etc.. //etc.. for Custom_page )

) AS SubData

Recent Answers


Roman Hutnyk answered on October 13, 2016 16:50 (last edited on October 13, 2016 17:00)

Andrew,

Have you tries adding alias for the custom type columns?

You might also consider using custom query, so you could name fields in the return statement like this:

SELECT DocumentName AS Title, DocumentID as ID FROM CMS_Documents
UNION ALL
SELECT SomeField AS Title, AnotherField as ID FROM CustomTable
1 votesVote for this answer Mark as a Correct answer

Anton Grekhovodov answered on October 13, 2016 19:04 (last edited on October 13, 2016 19:05)

Hi Andrew,

It's a very interesting and popular question.

I 've found some useful links for you:

http://devnet.kentico.com/questions/columns-content-filter-over-multiple-page-types

https://www.youtube.com/watch?v=8YAWafwYGDA (start watching from 08:30)

You can solve the issue in different ways)

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.