Copied to clipboard

Flag this post as spam?

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


  • Vincent Baaij 95 posts 344 karma points c-trib
    Jan 27, 2015 @ 11:59
    Vincent Baaij
    0

    How to get possible values for XmlCheckBoxPicker in code

    Hi,

    I have added a XmlCheckBoxPicker Datatype with a XPath. I'm usung this datatyep in da documenttype and it shows me a list of values to pick. So far, so good. I would like to assign the values programmatically. I'm not succeeding in getting the list. Does anyone know how to get the ALL the possible (not the picked) values through the API?

  • Hendy Racher 863 posts 3849 karma points MVP 2x admin c-trib
    Jan 27, 2015 @ 12:35
    Hendy Racher
    0

    Hi Vincent,

    Where do you want to perform this query ? inside a cutom label, there's a "keys" collection that has a csv of all the ids, but don't think there's an eqilivant property on the Picker obj returned by the PropertyValueConverter - perthaps a property called AllKeys would compliment the PickedKeys property ?

    Otherwise, you could use the configured XPath and re-query this via umbraco.uQuery.GetNodesByXPath() (if using tokens) or Umbraco.TypedContentAtXPath()

    HTH,

    Hendy

  • Vincent Baaij 95 posts 344 karma points c-trib
    Jan 27, 2015 @ 13:00
    Vincent Baaij
    0

    Hendy,

    I want to perform the 'query' in a CMSImport extension.

    We retrieve a xml file from a website and import this to items in an Umbraco site. We've built an extension which hooks into the record_imported event of CMSImport. In the event handler we need to set the value of a xmlcheckboxpicker field for which the data is not present in the xml file.

    I think adding the AllKeys property would be a great solution.

    For now I am using the TypedContentAtXPath approach you mentioned. Since I didn't succeed in getting the xpath from the datatype, I've now copied it into the source code for my extension. Although the xpath in the datatype is not going to change anytime soon, copying it does feel like a 'hack' and is bound to be forgotten to be updated when the datatype does change

Please Sign in or register to post replies

Write your reply to:

Draft