Portal Engine Questions on portal engine and web parts.
Version 6.x > Portal Engine > Categories and tag cloud on blog View modes: 
User avatar
Member
Member
agraham-e-xanthos.co - 3/9/2012 3:17:13 AM
   
Categories and tag cloud on blog
Hi, we are trying to get categories and the tag cloud working on a blog.

We know that there is a WHERE to select these, i.e.

Tags:
('{%ToInt(tagid, "")%}' = 0 AND '{%tagname%}'='') OR (DocumentID IN (SELECT DocumentID FROM CMS_DocumentTag WHERE TagID = {%ToInt(tagid, "")%} )) OR (DocumentID IN (SELECT DocumentID FROM CMS_DocumentTag WHERE TagID IN (SELECT TagID FROM CMS_Tag WHERE TagName = '{%tagname%}' AND TagGroupID = {%ToInt(groupid, "")%} )))

Categories:
'{%categoryid%}' = '' OR (DocumentID IN ( SELECT DocumentID FROM CMS_DocumentCategory WHERE CategoryID = '{%categoryid%}' ))

Both of these WHERE's work seperatly however we are trying to work out if these 2 WHERES can be merged so that a category OR tag can be selected. Is this possible?

Thanks
Ashley

User avatar
Kentico Support
Kentico Support
kentico_zdenekc - 3/15/2012 9:49:08 PM
   
RE:Categories and tag cloud on blog
Hi.

Well, yes, the simple idea would suggest to wrap each of the WHEREs in parentheses, put OR between them and use it as an universal where condition...
Have you tried that?

Regards,
Zdenek

User avatar
Member
Member
Patrick - 11/23/2012 8:04:44 AM
   
RE:Categories and tag cloud on blog
Hello guys,

I'v tried out Zdenekc's proposal, unfortunately without success. Could you please tell me what's wromg with my query? My SQL Kung Fu is rather weak ;)
(('{%ToInt(tagid, "")%}' = 0 AND '{%tagname%}'='') OR 
(DocumentID IN (SELECT DocumentID FROM CMS_DocumentTag WHERE
TagID = {%ToInt(tagid, "")%} )) OR (DocumentID IN
(SELECT DocumentID FROM CMS_DocumentTag WHERE TagID IN
(SELECT TagID FROM CMS_Tag WHERE TagName = '{%tagname%}' AND
TagGroupID = {%ToInt(groupid, "")%} )))) OR ('{%categoryid%}' = '' OR (
DocumentID IN ( SELECT DocumentID FROM CMS_DocumentCategory WHERE
CategoryID = '{%categoryid%}' )))
Thanks in advance

Pat

User avatar
Kentico Support
Kentico Support
kentico_janh - 11/26/2012 7:29:17 AM
   
RE:Categories and tag cloud on blog
Hello,

I just want to share final solution from our email conversation with other visitors:
('{%ToInt(tagid, "")%}' = 0 AND '{%tagname%}'='' AND '{%categoryid%}' = '') OR (DocumentID IN (SELECT DocumentID FROM CMS_DocumentTag WHERE TagID = {%ToInt(tagid, "")%}) OR DocumentID IN (SELECT DocumentID FROM CMS_DocumentTag WHERE TagID IN (SELECT TagID FROM CMS_Tag WHERE TagName = '{%tagname%}' AND TagGroupID = {%ToInt(groupid, "")%})) OR DocumentID IN (SELECT DocumentID FROM CMS_DocumentCategory WHERE CategoryID = '{%categoryid%}'))

Best regards,
Jan Hermann