2 Replies Latest reply on Apr 27, 2018 3:08 PM by Javier Gironella

    Splitting array with Postgresql

    Javier Gironella

      I am having some issues splitting data using a Postgresql data source.

       

      The data is stored in a database field as an integer array (integer[]).

       

      Similar to the example, all data contains numbers separated by commas, and the entire array is surrounded by brackets {}. The amount of data may vary per field, for example:

       

      field1 may be:

      {2018,2017,2015,2014,2013}

       

      (5 elements in array)

       

      Whereas field2 might be:

      {2015,2012,2010}

       

      (3 elements in array)

       

      Other than this simple difference, all data is homogeneous through the entire column.

       

      However, when I try splitting the data in Tableau, using the comma separator (,) or the comma separator and the brackets ({,}), I get the following error:

       

      "ERROR: function split_part(integer[], unknown, integer) does not exist; Error while executing the query"

       

      I am trying to split these fields so I can use them as individual columns in a view.

       

      Does anyone have any idea how to solve this?

       

      I appreciate your help very much!

       

      P.D.: I have attached a sample workbook (not connected to Postgresql) for issue replication.