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"

    Details

      Description

      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.

      EDITED:
      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]
      length:3
      

      experienced behaviour

      The script output is

      [A, B, C]
      length:1
      

      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(Arrays.toString(expandoValue));
      println('length:' + expandoValue.length);
      

        Attachments

          Issue Links

            Activity

              People

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

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Days since last comment:
                  5 years, 8 weeks, 2 days ago

                  Packages

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