Sunday 04 February 2007 2:27:47 pm
Hi Karsten I think you would be better off using the enhanced selection http://ez.no/community/contribs/datatypes/enhanced_selection as this seems to handle changing options the way you need. Unfortunately this means writing a conversion script that maps your selection to the enhanced selection but from what I remember of the enhanced selection datatype this should not be to hard. The bigger problem might be to adapt the templates to the new datatype, especially since you use it so extensively.
If you need to stick with the selection datatype I would go through all the contentobjectattributes of type selection, fetch the data_text attribute (which stores the ids of the options), map the ids to their values and store the values in a separate, temporary table with the contentobjectattribute id as identifier. Also store the class attribute id so you know which selection this entry belongs to. Then update your class definition. Then go again through all contentobjectattributes, fetch their selection values from the temporary table, fetch the corresponding option ids from the new class definition and insert the ids back into the data_text of the attribute. You might have to publish the objects afterwards to make the changes public on the webpage. So the script itself it not to complicated but it is pretty cumbersome if you make changes to the options often. It will also take a sweet while if you have a lot of objects. Hopefully you will get some better ideas next week but that's all you can expect over the weekend :-) Good luck Claudia
|