cancel
Showing results for 
Search instead for 
Did you mean: 

Convert d:text field to multiple values

skushnerenko
Confirmed Champ
Confirmed Champ

Is it possible to convert d:text field of used custom data model to multiple values?

I know that it is not possible to do in straight way, but may be there is a complex procedure.

Alfresco Community (Build: 201612)

1 ACCEPTED ANSWER

jpotts
World-Class Innovator
World-Class Innovator

Sure, this should not be too hard. Assuming you have a property called custom:someProp, edit your model to add a new property called custom:somePropMulti (or whatever you want, but obviously it has to be unique).

Now write a script to read the values from custom:someProp and write them to custom:somePropMulti. The easiest way to do this is probably with the Alfresco JavaScript Console but you could do this with any programming language you are comfortable with. For example, you could use Java or Groovy and connect via the Apache Chemistry OpenCMIS client. Or do with with Python and cmislib, etc.

View answer in original post

2 REPLIES 2

jpotts
World-Class Innovator
World-Class Innovator

Sure, this should not be too hard. Assuming you have a property called custom:someProp, edit your model to add a new property called custom:somePropMulti (or whatever you want, but obviously it has to be unique).

Now write a script to read the values from custom:someProp and write them to custom:somePropMulti. The easiest way to do this is probably with the Alfresco JavaScript Console but you could do this with any programming language you are comfortable with. For example, you could use Java or Groovy and connect via the Apache Chemistry OpenCMIS client. Or do with with Python and cmislib, etc.

I am just in doubt if I have a custom model with about twenty fields and I want to convert a few of them to multi value fields, the above method will result in significant increase of fields quantity.

And moreover a few of fields will remain unused after such a conversion.

But if this is the only possible solution I  use it.