Quantcast
Channel: Pentaho Community Forums
Viewing all articles
Browse latest Browse all 16689

Upping the game: mix datasource parameter with "fixed" parameter

$
0
0
Okay, first steps are done, now I want to up the game a little bit.

I'd like to add a new select/parameter combo to control how many months are displayed on my charts.

Since all datasources already use "top 6" on it's SQL Query, I thought "hey, I'll just change that to ${qtd} and problem solved!" - all I'd had to do, then, was create the parameter and set those charts to listen for it. But no. I got my ass kicked and have no idea why them queries won't work. Even before trying the components, I was trying CDA for the change - an example:
Code:

SELECT * FROM (
    SELECT top ${qtd}
        CASE codigoconta
            WHEN '100' THEN 'PR'
            WHEN '900' THEN 'PRE'
            WHEN 'basileia' THEN 'Basileia'
        end as codigoconta,
        dt_base,
        valorconta
    FROM dlotb000_final
    where versao in (
        select v.versao from (
            select distinct dt_base, max(versao) as versao
            from dlotb000_final
            group by dt_base, dlo_tipo) v
        )
    and dlo_tipo = ${dlo_tipo}
    and dt_base BETWEEN (${dt_base}-100) and ${dt_base}
    and codigoconta in ('item1','item2','item3')
    order by dt_base DESC, codigoconta DESC
) as temp
ORDER BY dt_base ASC

I keep getting this weird error:
Code:

cda:Query cdaPRPREBas in DLO/sql-jdbc.cda has failed with exception Line 3: Incorrect syntax near '@P0'.
[edit]forgot to finish it...[/edit]
anyway! The point here is: I have two parameters already set: doctype and yearmonth. They work wonderfully. I want to set up another "quantity", to control how many months are shown in my charts. If there's another way without changing the SQL Query above, I'm all yours.

Viewing all articles
Browse latest Browse all 16689

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>