Article List webpart is not working

Aashish Khandelwal asked on January 7, 2015 05:36

Look at the page TakeAChallenge.

This page is throwing an exception which is as follows:

 [Error loading the control 'ListOfArticles', check event log for more details]

[DataConnection.HandleError]: 

Query: 
SELECT * FROM 
(
SELECT *, ROW_NUMBER() OVER (PARTITION BY NodeID ORDER BY CASE WHEN [DocumentCulture] = @DocumentCulture THEN 1 ELSE 2 END) AS [CMS_C] FROM View_CMS_Tree_Joined_Versions INNER JOIN CONTENT_article ON View_CMS_Tree_Joined_Versions.DocumentForeignKeyValue = CONTENT_article.ArticleID WHERE ([ClassName] = N'cms.article') AND ([NodeSiteID] = @NodeSiteID AND (('' = 0 AND ''='') OR (DocumentID IN (SELECT DocumentID FROM CMS_DocumentTag WHERE TagID = )) OR (DocumentID IN (SELECT DocumentID FROM CMS_DocumentTag WHERE TagID IN (SELECT TagID FROM CMS_Tag WHERE TagName = '' AND TagGroupID = )))) AND ((NodeAliasPath = N'/Home/profile/people/amateur/triathlon/matt-fisher') AND [DocumentCulture] = @DocumentCulture))
) 
AS SubData
WHERE [CMS_C] = @CMS_C

Caused exception: 
Incorrect syntax near ')'.
Incorrect syntax near ')'. 

The webpart which is raising this exception is Article List whose properties are as follows:

Webpart properties (Article list)

Alias path: /Home/profile/people/amateur/triathlon/matt-fisher
Zone ID: zoneListOfArticles


Default


Web part control ID: ListOfArticles

Web part title: ListOfArticles


Visibility


Visible: True

Hide on subpages: False

{$content.showforpagetypes$}: 

Display to roles: 


Content


Path: 

Data source name: 


Content filter


Page types: cms.article

Category name: 

Combine with default culture: 

Culture code: 

Maximum nesting level: -1

ORDER BY expression: 

Select only published: True

Select top N pages: 

Site name: TakeaChallenge

WHERE condition: ('{?tagid|(toint)?}' = 0 AND '{?tagname?}'='') OR (DocumentID IN (SELECT DocumentID FROM CMS_DocumentTag WHERE TagID = {?tagid|(toint)?} )) OR (DocumentID IN (SELECT DocumentID FROM CMS_DocumentTag WHERE TagID IN (SELECT TagID FROM CMS_Tag WHERE TagName = '{?tagname?}' AND TagGroupID = {?groupid|(toint)?} )))

Columns: 

Filter out duplicate pages: False

Filter name: 


Transformations


Transformation: CMS.Article.ArticleList

Alternating transformation: 

Selected item transformation: CMS.Article.Profile

Item separator: 

Nested controls ID: 


Paging


Enable paging: True

Paging mode: querystring

Navigation buttons: split

Pager position: bottom

Page size: 10

Query string key: 

Show first and last buttons: True

HTML before: 

HTML after: 

Results position: top

Numbers separator: -


Relationships


Main page: 00000000-0000-0000-0000-000000000000

Main page is on the left side: False

Relationship name: isrelatedto


System settings


Check permissions: False

Load pages individually: False

Cache item name: 

Cache minutes: 

Cache dependencies: ##DEFAULT##



No data behavior


Hide if no record found: True

No record found text: No data found


Editing buttons


Show New button: True

New button text: Add new article<br />

{$editmode.showeditbutton$}: True

{$editmode.showdeletebutton$}: True


HTML Envelope


Content before: 

Content after: 


Web part container


Web part container: 

Container title: 

Container CSS class: 

Container custom content: 

Hide container on subpages: False


AJAX


Use update panel: False


Time zones


Time zone: server

Custom time zone: Indiana


Performance


Disable view state: False

Disable macros: False

Partial cache minutes: 

Partial cache dependencies: ##DEFAULT##


Preserve partial cache on postback: False


Output filter


Filter output HTML of web part: False

Resolve URLs: True

Fix attributes: True

Fix Javascript: True

Fix lower case: True

Fix self closing tags: True

Fix HTML5: True

Convert TABLE tags to DIV tags: none

Any Suggestions on this. This was working fine before I upgraded my system to Kentico 8.1 from 7x.

Regards
Aashish Khandelwal

Correct Answer

Josef Dvorak answered on January 7, 2015 13:43

Hi Aashis,

It looks like the (int) conversion does not work as expected. I suspect this may be a bug in Kentico 8, so I will submit a bug report to the development team for further investigation. You can use this method instead:

{?ToInt(tagid, "")?}

2 votesVote for this answer Unmark Correct answer

Recent Answers


Vilém Jeniš answered on January 7, 2015 08:56 (last edited on January 7, 2015 08:58)

Hi AASHISH!

The error is in your wherecondition. The syntax error is in this part precisely:

... AND TagGroupID = ))...

It's your macro expression

{?groupid|(toint)?}

that is wrong. To cast to integer in K# use (int) only. Therefore correct syntax of you macro should be

{?groupid|(int)?}

Same goes for the other macro expression. I hope this solves your problem.

Regards,

Vilem

0 votesVote for this answer Mark as a Correct answer

Aashish Khandelwal answered on January 7, 2015 09:59

Hi VILÉM JENIŠ,

Thanks for the answer but its not working.

[Error loading the control 'ListOfArticles', check event log for more details]

[DataConnection.HandleError]: 

Query: 
SELECT * FROM 
(
SELECT *, ROW_NUMBER() OVER (PARTITION BY NodeID ORDER BY CASE WHEN [DocumentCulture] = @DocumentCulture THEN 1 ELSE 2 END) AS [CMS_C] FROM View_CMS_Tree_Joined_Versions INNER JOIN CONTENT_article ON View_CMS_Tree_Joined_Versions.DocumentForeignKeyValue = CONTENT_article.ArticleID WHERE ([ClassName] = N'cms.article') AND ([NodeSiteID] = @NodeSiteID AND (('' = 0 AND ''='') OR (DocumentID IN (SELECT DocumentID FROM CMS_DocumentTag WHERE TagID = )) OR (DocumentID IN (SELECT DocumentID FROM CMS_DocumentTag WHERE TagID IN (SELECT TagID FROM CMS_Tag WHERE TagName = '' AND TagGroupID = )))) AND ((NodeAliasPath = N'/Home/profile/people/amateur/triathlon/matt-fisher') AND [DocumentCulture] = @DocumentCulture))
) 
AS SubData
WHERE [CMS_C] = @CMS_C

Caused exception: 
Incorrect syntax near ')'.
Incorrect syntax near ')'.
0 votesVote for this answer Mark as a Correct answer

Vilém Jeniš answered on January 8, 2015 08:41

I figured this:

The |(toint) is no longer available in from version 8 on. It was only until version 7. The recomended way now is using the ToInt method.

In some of the UIElements in your DB you can find the notation similar to this

{? tagid | int?}

which is basically the same thing without parenthesis. However this is not documented and isn't supported. I only mention this since you can find this by looking at the configuration of some of the UIElements.

To recapitulate: Use the ToInt macro method, since it's the best practice. The second parameter should be an integer according to documentation therefore I suggest

{?ToInt(tagid, 0)?}

or

{% ToInt(QueryString.tagid, 0)%}

and similar for the other one.

1 votesVote for this answer Mark as a Correct answer

Aashish Khandelwal answered on January 8, 2015 09:19 (last edited on January 8, 2015 10:00)

Thanks VILÉM JENIŠ and Kentico Support Team.

Regards
Aashish Khandelwal

0 votesVote for this answer Mark as a Correct answer

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