Custom parameters in Pentaho dashboards

3.7k views Asked by At

Custom parameters in a CDE/CTools dashboard are great for defaulting initial values of parameters, e.g. setting a date parameter to today. i.e. the parameter looks like:

function() { // some code return val }

However there is an issue with them. The first time you access a "custom parameter" in code, it is a function not a string. So you have to use:

paramName()

To get its value.

Once the end user selects a value then you have to use

paramName

This is really awkward in complicated dashboards with lots of prompts. Is there a better way this can be done? (Perhaps there is something in javascript I'm missing to help here?)

1

There are 1 answers

1
Codek On

OK, there is a solution, but I dont like it!

First; Move all the init code into named procedures e.g.

function monthInit() { return "june"; }

Then in the custom parameter for month, just say:

monthInit();

That way the custom parameter is always a string, and never starts off as a function.

Not ideal though because then all your init code is in a separate bit of js.