Copied to clipboard

Flag this post as spam?

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


  • Andrew Hopkins 2 posts 72 karma points
    5 days ago
    Andrew Hopkins
    0

    Using multinode tree picker value for query parameter

    I would like to run a query on a set of documents that match the name of an author that is chosen from a Multinode tree picker value of existing authors with a string value.

    For example:

    Select * documents where (Multinode Picker Value == "Frank Spencer")

    or

    Select * documents where (Multinode Picker Values contains "Frank Spencer, Donald Trump")

    I have set the picker control to only allow a single value and then put this into a variable using the .First() function, but keep getting stuck trying to move this forward.

    @{ var relatedAuthors = Model.Content.GetPropertyValue<IEnumerable<IPublishedContent>>("relatedAuthor"); var selectedAuthor = relatedAuthors.First().Name; }
    

    I have something similar (below) where I pass in two text variables into a query to show documents which meet a chosen sector or service.

    If anyone can point me in the right direction on how this could be achieved that would be great.

    @{ */ Variables /* var sectorKeyword = @Umbraco.Field("relatedInformationSector"); var serviceKeyword = @Umbraco.Field("relatedInformationService"); }
    
    @{ */ Query /*
    var rData = Model.Content.Site().FirstChild("knowledge").FirstChild("legalGuides").Children("legalGuide")
    .Where(x => x.IsVisible())
    .Where(x => x.GetPropertyValue<IEnumerable<string>>("Services").Contains(""+@serviceKeyword+"") || x.GetPropertyValue<IEnumerable<string>>("Sectors").Contains(""+@sectorKeyword+""))
    .OrderBy("CreateDate");
    }
    

    Any help or ideas would be gratefully received.

    Close, but no cigar!!

Please Sign in or register to post replies

Write your reply to:

Draft