Technical support This forum is closed.
Version 1.x > Technical support > Help with query View modes: 
User avatar
Member
Member
cpaul - 5/10/2005 6:23:37 PM
   
Help with query
I'm developing a system for associating product literature with our products.

I've added a CatalogNumbers field to the CMS.File object that contains a comma separated list of catalog numbers the document is applicable to. I have a DataList that uses the SelectNodesWhere property to grab the applicable documents.

However, the documents are arranged in a shallow hierarchy, such as:
Product Literature
-Product Inserts
-Publications
-Reference Document

Instead of the flattened DataList, I'd like to keep the hierchary, showing each document (file) under the category.

I'm using a MenuItem for the containers, but can create a custom class if need be, I'm just not sure how to grab the container tree if a child element matches the where clause.

Any ideas?

User avatar
Guest
admin - 5/12/2005 10:15:54 AM
   
Re: Help with query
Hi Chip,

I'm sorry for the delay in answering this question. Could you please post the SQL query you use now so that I can understand the issue better?

Thank you.

Best Regards,

User avatar
Member
Member
wtijsma - 5/12/2005 3:01:32 PM
   
Re: Help with query
Hi,

I did it with the CMSViewer selecting multiple classes and some hacking in a stylesheet, where the infosheetcollection is a container-only. Issue is that using a string[] for multiple classnames makes it impossible to use a custom order (passing the 'order' parameter gives an Exception because the collection doesn't have custom fields:

Basically it does this:

string[] classnames = new string[] {
"vitsol.infosheet",
"vitsol.infosheetcollection"
}

CMSViewer viewer = new CMSViewer();
viewer.SelectNodesClassNames = classnames;
viewer.TransformationName = classnames[0] + ".categorized";
viewer.SelectNodesPath = path;
viewer.ViewMode = CMSViewerViewModeEnum.MultipleItems;
viewer.SelectNodesOrderBy = order;
viewer.SelectNodesMaxRelativeLevel = 3;

the stylesheet looks like this:

<xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" xmlns:vitsol="http://www.vitronics-soltec.com/extensions"
exclude-result-prefixes="vitsol"
extension-element-prefixes="vitsol">

<xsl:output method="xml" version="1.0"
indent="yes" encoding="utf-8"
standalone="no" omit-xml-declaration="yes"/>

<xsl:strip-space elements="*"/>

<xsl:template match="vitsol.infosheetcollection">
<xsl:variable name="NodeID" select="NodeID"/>
<ul class="infosheets">
<li class="folder"><a href="{vitsol:MapAlias(AliasPath)}"><xsl:value-of select="NodeName"/></a>
<ul>
<xsl:for-each select="../vitsol.infosheet[ParentNodeID=$NodeID]">
<li class="infosheet">
<xsl:call-template name="vitsol.infosheet"/>
</li>
</xsl:for-each>
</ul>
</li>
</ul>
</xsl:template>

<xsl:template name="vitsol.infosheet">
<a href="{vitsol:MapAlias(AliasPath)}"><xsl:value-of select="InfoSheetNumber"/>. <xsl:value-of select="InfoSheetTitle"/></a>
</xsl:template>

<xsl:template match="vitsol.infosheet"/>

</xsl:stylesheet>


User avatar
Member
Member
cpaul - 5/13/2005 6:42:52 PM
   
Re: Help with query
So the viewer is producing xml of all the child and containers, but they are peers in the DOM, and then the styleshet reassociates the hierarchy by one of the attributes (the node id)? And to get multiple container levels you could add a similar for-each working on the infosheetcollection objects?

User avatar
Member
Member
wtijsma - 5/14/2005 12:52:32 PM
   
Re: Help with query
Yes, the data is retrieved like a normal dataset with multiple tables. A much better approach would be to add relations to the dataset, but because all components are completely encapsulated by the KenticoCMS components (DataSet, XsltTransformation) it's impossible to achieve this using the standard Kentico components.

User avatar
Guest
admin - 5/19/2005 2:06:02 PM
   
Re: Help with query
Hi Chip,

I'm sorry for the delay in answering this question. Did Wiebe's answer help you? If not, you could consider another solution: since version 1.6, there's a support for "general relationships" between the documents. If you need to specify that one file is related to several catalogs, you can do that using the Relationships feature that is available in the main menu. Then, you can use nested repeater to display the categories and files hierarchically.

Should you need any help with that, please feel free to ask me.

Best Regards,

User avatar
Member
Member
cpaul - 5/20/2005 10:44:54 PM
   
Re: Help with query
Thanks Petr, Wiebe's post has me on the right direction. I cannot use the general relationships because the catalog numbers in question are in the millions and do not exist within Kentico. I'm using Kentico for product pages, of which a given page is pertinent to many (in some cases thousands or millions) of products. As an analogy, it's like having a separate catalog number for every possible RGB code for the color of a product.

But I think I can get the categorized list of documents for a given catalog number using Wiebe's method.

Thanks again both you guys.