Are there any larger data types for strings in Alfresco?

1.3k views Asked by At

I'm working with a custom content model and I want to have a custom text field that serves the purpose of a description for the document. I've run into a problem with this field, because it seems I can't have a d:text property with more than 1024 characters.

Is there another property type that allows me to go over this limit? I'm using the content model to describe PDF documents, and these do not always have OCR performed on them, so I need the description field to make them searchable by Alfresco.

2

There are 2 answers

1
Teqnology On

d:text length depends on your database table. So try to increase that and you should be fine.

0
Sebastian Rieger On

It is very simple, to set a bigger limit, than 1024 characters, to a attribute which is from the type "d:text". You must modify the file custom-config-model.xml which you can find in folder ALFRESCO_HOME/tomcat/shared/classes/alfresco/web-extensions.

In the config from your node-type you must write something like in the following example:

    <config evaluator="node-type" condition="your:model">
        <forms>
            <form>
                <field-visibility>
                    ...
                    <show id="your:attribute" />
                    ...
                </field-visibility>
                <appearance>
                    ...
                    <field id="your:attribute">
                        <control template="/org/alfresco/components/form/controls/textarea.ftl">
                            <control-param name="maxLength">40000</control-param>
                        </control>
                    </field>
                    ...
                </appearance>
            </form>
        </forms>
    </config>

The fist thing you do with that code is:

  • You show the attribute
  • You make the textfield to a template which is called textarea (much better for a text or something)
  • you set the maximal length of the attribute to 40.000 characters (which should be enough) If you don't want the textfield as textarea delete the template attribute from the control section.

After this manipulation you can save strings with up to 40.000 characters in this attribute.

Hope I could help you!