Copied to clipboard

Flag this post as spam?

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

  • Steve 139 posts 318 karma points
    Jun 04, 2014 @ 05:21

    HasVortoValue available when selecting nodes?

    Hi Matt,

    I would like to build a multilingual news section where nodes are selected based on availability of a Vorto value in the title field. The goal is to display only those news items which contain text in the current language.

    (MVC Razor code is new to me) I'm looking for something along the lines of:

    var homePage = CurrentPage.AncestorsOrSelf(2).First();

    var newsOverview = homePage.umbNewsOverviews.First();

    var newsItems = newsOverview.umbNewsItems.Where(*this is where I'd like to select title items which have a Vorto value).OrderBy....

    Is there a way to do this - either with this code, or perhaps an alternate approach?

    Best regards,


  • Steve 139 posts 318 karma points
    Jun 04, 2014 @ 06:40

    Hi again Matt,

    I found a solution which seems to work nicely:

    IPublishedContent parent = CurrentPage.AncestorOrSelf(2).umbNewsOverviews.First();

    var newsItems = parent.Children.Where(x => x.HasVortoValue("title")).OrderBy(x => x.SortOrder);

    Of course I'm open to alternatives if you know of a better method.

    Thanks again for sharing Vorto.

    Best regards,


  • Matt Brailsford 2362 posts 11452 karma points MVP 6x c-trib
    Jun 04, 2014 @ 08:57
    Matt Brailsford

    Hi Steve,

    Nope, that's pretty much how I would do it so I think you've got it pretty spot on.

    Good work on figuring it out yourself, I love an inquisitive mind :) #h5yr


  • Steve 139 posts 318 karma points
    Jun 04, 2014 @ 15:26

    Fantastic. Thanks Matt.

    BR, Steve

Please Sign in or register to post replies

Write your reply to: