Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Niels Hartvig 1951 posts 2391 karma points c-trib
    Feb 05, 2015 @ 23:31
    Niels Hartvig
    0

    Feedback needed: Let us know what you want to query

    NOTE: In this particular request for feedback we hope for feedback from new users (or users who remembers what they found difficult when they started). In a later thread we may ask for more advanced/edge use cases, so for the super-razor-experts: Don't reply - your time will come :-)

    We're working on improvements to the query syntax and engine of Umbraco and for making test cases we'd love to hear about your querying needs and see examples of what you do (or try to do) today. The more details the better so we can understand as much as possible.

    For instance: "I have a football site listing various teams with their players as sub nodes. On the homepage, I need to list the top five strikers (dropdown value) with most goals (number value) grouped by country (country picker)".

  • Warren Buckley 2106 posts 4836 karma points MVP 7x admin c-trib
    Feb 06, 2015 @ 11:01
    Warren Buckley
    0

    Hi Niels & the lovely Core Team,
    I know this thread is not aimed directly at me as being a long time user now, but I do have some very early memories of my first experiences with Umbraco

    My frustration at the time (even though XSLT was the querying language of choice at the time) was the steep learning curve of understanding of how to query and fetch content and nodes from various other pages in my site. No specific queries spring to mind at this time.

    However I think for a newcomer to the platform finding a way with a GUI like tool to help me pick, choose & filter basic queries would have helped me loads and its great to see this as a recent addition to the core and would like to see this expanded on and improved to give a good start on creating queries.

    Obviously these days its a little harder for common queries in sites, as there is a more common pattern of the content hierarchy in the backoffice not necessarily reflecting the site structure as sites become more relational. So I would think more time spent improving the new GUI to help picking, filtering and building up a rather semi-complex query would be fantastic to see and would help beginners and us old timer's too :)

    Keep up the good work!
    Warren :)

  • Claushingebjerg 939 posts 2574 karma points
    Feb 06, 2015 @ 15:12
    Claushingebjerg
    0

    Queries to render:

    · An item from Mediapicker
    · An image from ImageCropper
    · A series of items from multi media picker. 

  • Dan Okkels Brendstrup 101 posts 197 karma points
    Feb 10, 2015 @ 10:33
    Dan Okkels Brendstrup
    2

    I wish I could contribute usefully here, but looking over the (Umbraco 7) Razor solutions we've built, querying hasn't really been the big problem -- possibly just because those specific solutions haven't required sophisticated querying.

    It has mostly been a question of selecting non-hidden child pages that have a template defined, to generate a navigation:

    @foreach(var page in frontPage.Children.Where(p => p.IsVisible() && p.TemplateId != 0)) {}
    

    ...or checking for non-hidden pages that are not of some specific doctype:

    @if(child.Children<Global>().Any(c => c.UmbracoNaviHide == false && c.DocumentTypeAlias != "News" && c.DocumentTypeAlias != "Employee") ) {}
    

    But the currently implemented querying methods generally make sense if you know XPath already.

    The bigger problem, for we non-C#-knowledgeable frontend developers, has been two things:

    1. Figuring out how to access strongly typed properties, and what to do with them without Intellisense and/or knowledge of .NET types (Inspect to the rescue).

    2. Guarding against errors without solid knowledge of how various strongly typed datatypes can be null/undefined/empty string etc.

    The latter has been trial and error in various combinations of IsNullOrWhiteSpace(), HasValue(), Any(), FirstOrDefault() and friends. Easy stuff for a .NET-developer, surely, but surprisingly tricky for a mere mortal frontend developer. And this is serious business in Razor, since the entire page rendering blows up into a YSOD at the tiniest of mistakes.

    Is there any way that guarding against errors and empty values in various datatypes can be made easier? It's my impression that HasValue() already attempts to wrap some magic checks for empty values for different datatypes, so perhaps that can be extended?

    Being used to XSLT "failing silently" when encountering empty values (with correct use of <xsl:apply-templates />, at least), it's a much more uneasy feeling to deploy a Razor view to production and cross your fingers that the editors won't construct some combination of empty or erroneous values that you haven't anticipated, that will suddenly YSOD their production website. Any help guarding against that would be appreciated (and perhaps the solution is to "learn C#" or leave the writing of Razor views to those who know it).

  • Craig100 1136 posts 2523 karma points c-trib
    Feb 10, 2015 @ 13:20
    Craig100
    0

    Some sort of site traverser which, having selected a node, could then traverse down the children and possibly show the properties and values of each would be fantastic :)

    Craig

Please Sign in or register to post replies

Write your reply to:

Draft