Programatically Updated DataType Prevalue Sort Order
After a long battle trying to programmatically create prevalues for a datatype I have had some success (not sure why it's quite so difficult?) but I now can't seem to update the sort order for existing prevalues. Anyone got any ideas how to achieve it given that the sort order field is read-only? I'm trying to keep the options in alphabetical order.
As you say SortOrder is readonly, so i think the only way to do it. is to remove the existing preValue from the datatype prevalue collection and then add it back in with the SortOrder passed in the constructor.
itemPreValues.Add(alias, new PreValue(id, value, sortOrder));
if you are doing a insert and want to update all the sort orders - its probably easier to just create a new PreValue dictionary collection, and go through the existing ones putting all new PreValues into the new collection and set that back to the datatype once you're done.
Kevin, in making changes like this programmatically it will presumably mean the Lucene index is incorrect as I noticed it stores the prevalue id rather than the value. So, if I remove and add them again the document(s) using the datatype would need to be republished with the new prevalue id's? Is that correct?
Programatically Updated DataType Prevalue Sort Order
After a long battle trying to programmatically create prevalues for a datatype I have had some success (not sure why it's quite so difficult?) but I now can't seem to update the sort order for existing prevalues. Anyone got any ideas how to achieve it given that the sort order field is read-only? I'm trying to keep the options in alphabetical order.
Hi
As you say SortOrder is readonly, so i think the only way to do it. is to remove the existing preValue from the datatype prevalue collection and then add it back in with the SortOrder passed in the constructor.
if you are doing a insert and want to update all the sort orders - its probably easier to just create a new PreValue dictionary collection, and go through the existing ones putting all new PreValues into the new collection and set that back to the datatype once you're done.
Thanks Kevin, I'll give that a go then.
Kevin, in making changes like this programmatically it will presumably mean the Lucene index is incorrect as I noticed it stores the prevalue id rather than the value. So, if I remove and add them again the document(s) using the datatype would need to be republished with the new prevalue id's? Is that correct?
is working on a reply...