Developer Forum »
Replace a ShortStringProperty with a LongStringProperty
37 posts

Hi,

We have a property, let's call it "TooLongString", in a content class that's currently a ShortStringProperty. We would like to change this to a LongStringProperty instead. Still, we don't want to lose the data in existing "TooLongString" fields.

Is it sufficient to create a new LongStringProperty with the same name? Or will this not work as they have separate IDs? Is there any other hack we can do to change the existing property to a LongStringProperty?

Anna

171 posts

If you create a new LongStringProperty, it will, as you correctly guess, get a new guid id. So for the system, they will appear as two different properties.

I would suggest the following procedure:

Create the new longstring property

To copy the existing data in the shortstring column, you can create a workflow, and set the new longstring property value from the shortstringproperty value. 

Another alternative (and quicker) is to use SQL directly on the database. Find the tablename of the relevant class, and use one of the examples from here: 

https://stackoverflow.com/questions/6308594/how-can-i-copy-data-from-one-column-to-another-in-the-same-table 

1