Portal Engine Questions on portal engine and web parts.
Version 5.x > Portal Engine > ExecuteQuery error in TagCloud-related CMSRepeater View modes: 
User avatar
Member
Member
ricardo.fiel - 1/25/2010 12:54:06 PM
   
ExecuteQuery error in TagCloud-related CMSRepeater
Hi everyone,

Following the TagCloud web part tutorial (http://www.kentico.com/docs/devguide/index.html?using_the_tag_cloud_web_part.htm), I added the following code:


<gr:TagCloud ID="TagCloud1" runat="server" TagGroupName="MyTagGroup" DocumentListURL=""
QueryStringName="tagid" AliasPath="./%" SiteName="MySite" />

<cms:CMSRepeater SiteName="MySite" SelectOnlyPublished="true" ID="CMSRepeater1" runat="server" ClassNames="MySite.MyDocType" Path="./%" MaxRelativeLevel="1"
TransformationName="MySite.MyDocType.Default" WhereCondition="({%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)%})))">


When I run the page, I get the following error:


[DataConnection.ExecuteQuery]: Query: SELECT * FROM View_GR_Game_Joined WHERE ((((((SiteName = N'MySite') AND (Published = 1)) AND (DocumentCulture = N'en-US')) AND (NodeLevel <= 3)) AND (NodeAliasPath LIKE N'/PSP/Jogos/%')) AND (DocumentID IN (SELECT DocumentID FROM CMS_DocumentTag WHERE TagID = CAST({%tagid%} as int(2) ) )) : caused exception: Incorrect syntax near '?'.


Any ideas on whats causing this?

Thanks.

User avatar
Kentico Consulting
Kentico Consulting
kentico_mirekr - 1/26/2010 2:17:36 AM
   
RE:ExecuteQuery error in TagCloud-related CMSRepeater
Hi,

You need to set up your where condition in code. Example:

int tagid = QueryHelper.GetInteger("tagid", 0); 
int groupid = QueryHelper.GetInteger("groupid", 0);
string tagname = QueryHelper.GetString("tagname", "");

this.CMSRepeater1.WhereCondition = "(" + tagid + " = 0 AND '" + tagname + "'='') OR (DocumentID IN (SELECT DocumentID FROM CMS_DocumentTag WHERE TagID = " + tagid + ")) OR (DocumentID IN (SELECT DocumentID FROM CMS_DocumentTag WHERE TagID IN (SELECT TagID FROM CMS_Tag WHERE TagName = '" + tagname + "' AND TagGroupID = " + groupid + ")))";
this.CMSRepeater1.ReloadData(true);


I hope this will help you.

Best regards,
Miroslav Remias.