Hitachi Vantara Pentaho Community Forums
Results 1 to 2 of 2

Thread: CDE Pass dimension as parameter

  1. #1
    Join Date
    Dec 2014
    Posts
    2

    Default CDE Pass dimension as parameter

    In sql select statement for CDE dashboard , we have an option to pass numeric-field as parameter :

    SELECT
    DISTINCT brand_name AS "Brand Name",

    CASE
    WHEN ${param_Measure}='unit_sales' THEN sum(unit_sales)
    ELSE sum(store_sales)

    END AS "Sales"


    FROM product p
    INNER JOIN sales_fact_1997 sf7
    ON p.product_id=sf7.product_id
    INNER JOIN time_by_day t
    ON sf7.time_id=t.time_id
    WHERE
    t.the_date>='2012-01-01' AND t.the_date<='2012-01-07'

    GROUP BY "Brand Name"

    ORDER BY "Sales" DESC

    But I tried passing Non-numeric field as parameter and got error processing component . I tried the below code :

    select
    case when ${Dimension} = 'gender_code'
    then gender_code
    when ${Dimension} = 'Grade_code'
    then Grade_code
    end as "dimension",
    sum(leave_count) as leave_count
    from hcm_leave_itf_tb
    group by ${Dimension}

    Kindly help me to resolve the issue.




  2. #2
    Join Date
    Nov 2011
    Posts
    1,229

    Default

    the group by clause will certainly not work like you have it - We're using prepared statements to inject the parameters into the query and they don't allow for that.
    Pedro Vale
    --
    CTools Product Development
    http://www.webdetails.pt

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Privacy Policy | Legal Notices | Safe Harbor Privacy Policy

Copyright © 2005 - 2019 Hitachi Vantara Corporation. All Rights Reserved.