Uploaded image for project: 'PUBLIC - Liferay Portal Community Edition'
  1. PUBLIC - Liferay Portal Community Edition
  2. LPS-44195

Can not get String array from Expandovalue with "Group of Text Values"



      When getting "Group of Text" type of ExpandoValue, I can not get a well-filled array of String, just a 1 length String array, in which the 0th elementh contains the all the values in one String.

      I changed the string literal in the groovy script from dimension to length, because "dimension" can be misleading.

      steps to reproduce

      1. create a custom field (let the key name : "testkey") for Document Folders, type: Group of Text Values
      2. create a Document Folder, fill in the "testkey" field with value of "A[ENTER]B[ENTER]C". (Where [ENTER] means press the Enter key)
      3. check the "expandovalue" table, there should be a row there, where _data is similar to A B C
      4. note the classPK and companyID values.
      5. use the groovy script to get this field value, with the appropriate classPK and companyID values.
        • go to Server Administration, scripts
        • set Javascript to Groovy
        • copy paste the groovy script here into the textarea field
        • click on Execute

      expected behaviour

      The script output should be:

      [A, B, C]

      experienced behaviour

      The script output is

      [A, B, C]

      the groovy script for testing

      change classPK and companyID !

      import com.liferay.portlet.expando.model.ExpandoValue;
      import com.liferay.portlet.documentlibrary.model.DLFolder;
      import com.liferay.portlet.expando.model.ExpandoTableConstants;
      import com.liferay.portlet.expando.service.ExpandoValueLocalServiceUtil;
      import java.util.Arrays;
      classPK = 10469;
      companyID = 10156;
      expandoValue = ExpandoValueLocalServiceUtil.getData(companyID,DLFolder.class.getName(), ExpandoTableConstants.DEFAULT_TABLE_NAME, "testkey",classPK,new String [0]);
      println('length:' + expandoValue.length);


        1. reproduction_steps.odt
          549 kB
          Peter Borkuti
        2. test-trunk.jpg
          37 kB
          Peter Borkuti

          Issue Links



              • Votes:
                0 Vote for this issue
                1 Start watching this issue


                • Created:
                  Days since last comment:
                  5 years, 14 weeks, 6 days ago


                  Version Package
                  6.1.X EE
                  6.2.2 CE GA3
                  6.2.X EE
                  7.0.0 M1