Hitachi Vantara Pentaho Community Forums
Results 1 to 6 of 6

Thread: Error initializing custom parameter

  1. #1
    Join Date
    Oct 2012
    Posts
    13

    Default Error initializing custom parameter

    Hi everybody,

    I want to link two dashboards and I want to pass some parameters. I've checked the forum and found this thread. But I didn't get so far.

    I've created a custom javascript parameter in CDE (using Generic -> Custom parameter), named it mConcept and then, in the "Javascript code" property I put:
    Code:
    function f()
    {
        alert('Hello');
        if(Dashboards.getQueryParameter("mConcept") !== "")
        {
            return Dashboards.getQueryParameter("mConcept");
        }
        else
        {
            return "Default";
        }
    }
    I've previewed the dashboard and, since I dind't send any parameter through the url, I expect the value of mConcept to be "Default". I've used an "alert" and even created a text component to show the value of the parameter and it's the whole function. I mean, mConcept equals the code above, as if CDE didn't think it was a code to execute but a plain text that should be assigned to the parameter. Of course, the "Hello" alert never appears.

    I guess it's pretty simple, but I can't found what I'm doing wrong. The only other property (even in the advanced section) I see is "Bookmarkable" and I've tried with false and true with the same result. Please, someone can help me?

    Thanks in advance,
    Palen.

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

    Default

    hey, there.

    Have you tried changing the bracket to the first line, so that it reads function f() {.
    I know CDE is very peculiar when interpreting javascript functions. we recently solved an issue in the text component that sounds very similar to yours: http://redmine.webdetails.org/issues/112
    what version of cde are you running?


    cheers
    Pedro Vale
    --
    CTools Product Development
    http://www.webdetails.pt

  3. #3
    Join Date
    Oct 2012
    Posts
    13

    Default

    Quote Originally Posted by pamval View Post
    Have you tried changing the bracket to the first line, so that it reads function f() {.
    I know CDE is very peculiar when interpreting javascript functions. we recently solved an issue in the text component that sounds very similar to yours: http://redmine.webdetails.org/issues/112
    what version of cde are you running?
    Thanks for your help, Pedro.

    I've tried to write " function f(){", "function f(){", "function f() {", removing the name of the function, ... Firebug doesn't complain, but the alert doesn't show. I've tried this function:
    Code:
    function f(){ 
        alert("Hello");
        return 1;
    }
    I've used my old dashboard, but I've tried too with a new cde, without any components, and just a custom parameter with the above code.

    About the version, before these tests I've run the ctools installer script, downloaded everything ok, and this is what is written in the file pentaho-solutions\system\pentaho-cdf-dd\version.xml: <version branch='STABLE' buildId=''>12.10.17</version>

    Btw, I'm using Windows Xp 32 bits Sp 3 and Firefox 12 (IE 8 didn't work, either).

    Thanks again.

  4. #4
    Join Date
    Jul 2007
    Posts
    2,498

    Default

    try function(){...}


    One other option is using the javascript snippet, and putting the entire code (with the component)
    Pedro Alves
    Meet us on ##pentaho, a FreeNode irc channel

  5. #5
    Join Date
    Jul 2007
    Posts
    2,498

    Default

    ... or you could only use:


    Dashboards.getQueryParameter("mConcept") || "Default"

    without any of the function part
    Pedro Alves
    Meet us on ##pentaho, a FreeNode irc channel

  6. #6
    Join Date
    Oct 2012
    Posts
    13

    Default

    Quote Originally Posted by pmalves
    try function(){...}
    I'm afraid it didn't work.

    Quote Originally Posted by pmalves
    Dashboards.getQueryParameter("mConcept") || "Default"
    This worked perfectly!

    Quote Originally Posted by pmalves
    One other option is using the javascript snippet, and putting the entire code (with the component)
    That would work too. For now, as a workaround, I was using the "Pre Execution" property of a component of the dashboard. However, reading the link pamval provided, I'm pretty sure it was the same bug described there. It's fixed in the version that will be released tomorrow, so I'll update my ctools installation to see if it works then!

    Thanks for your help.

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.