US and Worldwide: +1 (866) 660-7555
Results 1 to 6 of 6

Thread: Creating array from database columns

  1. #1
    Join Date
    Aug 2009
    Posts
    3

    Default Creating array from database columns

    Hi!

    I am about to create my first report and would really like to use the sparkline feature. I as have read in thte documentation it expects an array or a csv input.

    However in one of the use cases I'd like to do there are many and changing number of rows in the resultset so creating subqueries as discussed in this blog is out of the question.

    So is there any way I can transform a rowset like this:
    Values
    -----
    50
    49
    45
    40
    ..
    30

    into an array in order to use it as sparkline input?

    thanks and regards
    elliot

  2. #2
    Join Date
    Aug 2009
    Posts
    3

    Default still looking

    I've been looking for a solution in the meantime. Am i missing something obvious?

  3. #3
    Join Date
    Jun 2007
    Posts
    1

    Default

    I use sparklines, I create a stored procedure to create a text string of those values.

    The documentation says it can take an array if the database supports it, but I had no luck passing an array.

    I use Postgres, you may want to mention what database you are using.

  4. #4
    Join Date
    Aug 2009
    Posts
    3

    Default database

    We use postgres too, so no group_concat unfortunately.

    By the way does anyboda know what the Raw Data Field do when creating a sparkline expression.
    Can this field used to feed input?


  5. #5

    Default Any luck?

    I was just wondering if you ever found a solution to this? I have a normal dataset and I would like to add a sparkline in my group header. It seems as though all that needs to happen is to take each value of the group and add it to an array, which I would use for my sparkline. I would have expected there to be a function for this, but I can't seem to find one!

    Any help would be appreciated

    - Dan

  6. #6
    Join Date
    Aug 2010
    Posts
    8

    Default

    I've been using the suggestion off this page to do this in postgres:
    http://explainextended.com/2009/05/0...ate-functions/

    basically you create a single column dataset and pass that to the ARRAY function, then pass that result to the array_to_string function.
    SELECT array_to_string(ARRAY(SELECT value FROM mytable))

    Something like that..

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •