Odd behavior from universal viewer.

Vic Carter asked on October 2, 2014 18:50

I am not really sure how to tag this, but here is my issue. I am using a hierarchical transformation and a universal viewer to generate my side navigation. In one section of my site I have need to only show sub items for the selected path(a setting available in the CMS Menu Control, however that control is not flexible enough to suit my needs). By breaking the where clause, I am able to see what query is being called, thus I can create a view in site manager to test my conditionals in advance. Here is the query being generated:

FROM View_CMS_Tree_Joined 
WHERE ((((NodeSiteID = 38) AND (Published = 1)) 
AND (DocumentCulture = N'en-US')) AND (NodeAliasPath LIKE N'/Products/%')) 
AND ((DocumentMenuItemHideInNavigation = 0) OR (DocumentMenuItemHideInNavigation IS NULL) OR (DocumentMenuItemHideInNavigation = ''))  
AND ((NodeLevel = 2) OR (SUBSTRING(NodeAliasPath,1,50) = SUBSTRING('{%CurrentDocument.NodeAliasPath#%}',1,50)))    

When I test this query, I get the expected results from my view. All items directly under "Products" as well as the sub items on my current path. However, when my condition is added to the where condition of my universal viewer webpart, all I get are the items directly under "Products". The rest of the tree is collapsed. What I am wondering if there is a particular setting that I may have set to cause this behavior. Here are the web part control settings:

Path - /{0}/% Maximum Nesting level - 2 WhereCondition - ((DocumentMenuItemHideInNavigation = 0) OR (DocumentMenuItemHideInNavigation IS NULL) OR (DocumentMenuItemHideInNavigation = '')) AND ((NodeLevel = 2) OR (SUBSTRING(NodeAliasPath,1,50) = SUBSTRING('{%CurrentDocument.NodeAliasPath#%}',1,50)))

And I am using a hierarchical transformation. On any section where I do not add my where condition, I see what I would expect(2 levels of navigation on the selected path)

Any thoughts as to what might be happening, or an alternative solution to the problem of showing items on a selected path?

Thank you in advance.

Recent Answers

Juraj Ondrus answered on December 6, 2014 11:10

Hi Vic,

I believe that the issue is the Path expression set in the web part. It says the web part to check just the current path. you need to be more general in this setting, maybe just using two dots (..). Or, maybe writing a custom macro that will return the path property value dynamically.

Best regards,
Juraj Ondrus

0 votesVote for this answer Mark as a Correct answer

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