How to change separator for Multivalued fields

By default TermWeb is using comma , as separator for storing values in database for Multivalued fields. Because of that users won’t be able to use comma in values for Multivalued fields.
In case when this value is not applicable for you needs you can change it by configuring TermWeb.

Instructions

For new installation

You need to configure only one property and start TermWeb.

  1. Edit file termweb.properties in termweb home folder and add or edit property multivalued.separator
    For example:

    multivalued.separator=;
  2. Start TermWeb.

For existing installation

To update separator for existing installation you need first pick new separator, update old values by replacing values containing new separator with some replacement.

  1. Stop TermWeb.

  2. Backup database before update.

  3. Replace old values containing new separator with something else, for example new separator is ; and replacement will be . :

    UPDATE tw_value v SET v.value_unicode = REPLACE(v.value_unicode, ';', '.'), v.value_normalized = REPLACE(v.value_normalized, ';', '.') WHERE v.field_oid IN (SELECT f.oid FROM `tw_field` f WHERE f.cat_id = 'GMULTIVAL'); UPDATE tw_picklistitem li SET li.name = REPLACE(li.name, ';', '.') WHERE li.field_oid IN (SELECT f.oid FROM `tw_field` f WHERE f.cat_id = 'GMULTIVAL');

     

  4. Replace old separator , with new ; :

    UPDATE tw_value v SET v.value_unicode = REPLACE(v.value_unicode, ',', ';'), v.value_normalized = REPLACE(v.value_normalized, ',', ';') WHERE v.field_oid IN (SELECT f.oid FROM `tw_field` f WHERE f.cat_id = 'GMULTIVAL');

     

  5. Edit file termweb.properties in termweb home folder and add or edit property multivalued.separator

    multivalued.separator=;
  6. Start TermWeb and test results

     

Related articles