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?
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()
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
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?
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
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
is working on a reply...