Hitachi Vantara Pentaho Community Forums
Page 1 of 2 12 LastLast
Results 1 to 10 of 15

Thread: how tu use Click action in CDE

  1. #1
    Join Date
    Apr 2011
    Posts
    5

    Default how tu use Click action in CDE

    Hi All,

    i want to use drilling in CDE by used Click action
    can anybody here give me sample the javascript
    to use click work.

    thanks

  2. #2
    Join Date
    Oct 2010
    Posts
    20

    Default it's really easy

    you should define a function.

    paste this code in the clickAction:

    function(a,b,c){
    //To see what is comimg... i don't remember exactly but is serie name, categoy name and value...
    alert(a);
    alert(b);
    alert(c);
    //Afeter that fire a change in the dashboard
    Dashboards.fireChange('parameter',c); //for instance
    }

  3. #3

    Default

    Hi,
    anybody can tell me a javascript example to open a report with params in click action.

    Thanks a lot
    Leticia

  4. #4

    Default

    Hi every body,

    I have a problem with this function

    function f1(s,c,v){
    Dashboards.fireChange('param',c);
    alert(s);
    alert(c);
    alert(v);
    }

    and it return :

    null.null

    undefined

    undefined

    Where is the problem ?

    thx all

  5. #5
    Join Date
    Mar 2012
    Posts
    645

    Default

    Hi,

    you're using a CCCv1 clickAction handler's signature: «function(s,c,v) { ... }».

    In CCCv2, the clickAction handler signature has changed. You can learn more here.

    Here's a quick example (applicable to categorical charts):
    Code:
    function(scene) {
        var vars = scene.vars;
        var s = vars.series.value;
        var c = vars.category.value;
        var v = vars.value.value;
        alert("series: " + s + "\ncategory: " + c + "\nvalue: " + v);
    }

  6. #6
    Join Date
    Jun 2013
    Posts
    15

    Default

    Quote Originally Posted by duarte.leao View Post
    Hi,

    you're using a CCCv1 clickAction handler's signature: «function(s,c,v) { ... }».

    In CCCv2, the clickAction handler signature has changed. You can learn more here.

    Here's a quick example (applicable to categorical charts):
    Code:
    function(scene) {
        var vars = scene.vars;
        var s = vars.series.value;
        var c = vars.category.value;
        var v = vars.value.value;
        alert("series: " + s + "\ncategory: " + c + "\nvalue: " + v);
    }
    I am using the above code into a Pie Chart in the clickAction and I am getting this javascript error:


    Uncaught Error: [pvChart ERROR]: Cannot read property 'value' of undefined
    pvc.error
    f.$listener.f.$listener

  7. #7

    Default

    Thx duarte.leao !!

    herohat try this :
    function func1(){


    //var atom = this.scene.atoms.series;
    var atom = this.scene.atoms.category;
    //var atom = this.scene.atoms.value;
    Dashboards.fireChange('parameter',atom.value);
    alert(atom.value);


    }

  8. #8
    Join Date
    Mar 2012
    Posts
    645

    Default

    Hi,

    That's right, not all charts define the "series" visual role, and the Pie is one of them.
    Just remove the "series" code:
    Code:
    function(scene) {
        var vars = scene.vars;
        var c = vars.category.value;
        var v = vars.value.value;
        alert("category: " + c + "\nvalue: " + v);
    }
    Anyway, you should instead follow herohat's suggestion. The method he suggests uses the scene's "atoms" dictionary instead of the "vars" dictionary. If you wanna know why, read below, where I explain why this is generally preferable in a "clickAction" handler.

    In CCC charts two different views of information coexist.

    The business data view: "atoms" is a dictionary whose keys are the names of dimensions and whose values are the Atom objects. Atom objects are present in Datum objects, the "rows" of CCC's internal data model. The names of dimensions should be that of business concepts (although default dimension names never are...).

    The visual data view: "vars" is a dictionary whose keys, generally, are the names of the visual roles that the scene represents and whose values are a Var object.

    Due to the grouping and aggregation that CCC performs, the values of each might not be the same. This can happen if more than one dimension is mapped to a visual role or if more than row exists with the same "key" values, in which case the value dimension is summed up.

    If you have a dimension named "productType" and map it to the "category" visual role, by specifying «categoryRole: productType», then:
    • in "vars" you'll find an entry for "category"
    • in "atoms" (and in "firstAtoms") you'll find an entry for "productType"


    If you have dimensions named "productFamily" and "productType", and map these to the "category" visual role, by specifying «categoryRole: productFamily, productType», then:
    • in "vars" you'll find an entry for "category", having a value built from the value of both atoms (the concatenation of both values, separated by the dataSeparator; for example: "Cars~Ford"
    • in "atoms" (and in "firstAtoms") you'll find separate entries for both "productFamily" and "productType"


    If you have a dimension named "sales" and map it to the "value" visual role, by specifying «valueRole: sales», then:
    • in "vars" you'll find an entry for "value", with a value that is:
      • identical to the "sales" dimension value, if there is only one Datum present in the scene
      • the sum of the values of the "sales" dimension, if there is more than one Datum present in the scene

    • in "atoms" you won't have an entry for "value" -- generally you'll only find "key" atoms here (think group by dimensions)
    • in "firstAtoms", you'll find an entry for "sales" -- it's the "atoms" dictionary of the first Datum in the scene


    When to use each view?

    • vars -- when you are doing visual extension related stuff, you usually don't care about which dimension(s) are mapped to a given visual role. You just wanna know the value of the "category" variable...
    • atoms -- if you're doing business-related stuff, like interfacing with another chart, or drilling-down, or opening a popup, you should need/use the values of business dimensions.


    In conclusion, I guess that my initial advice of using "vars" in the clickAction was not the ideal one, because "clickAction" is generally used for performing "business" tasks. I guess I felt lazy to explain the "atoms" vs "vars" concept...but here you have it.

  9. #9
    Join Date
    Jun 2013
    Posts
    15

    Default

    This is amazing! thanks a lot OMDCAPSYS and duarte.leao.


    You can give me some tips to make drill downs working with a "Table component". The aim is when the user make click into a row/column and display a new table or data...

  10. #10
    Join Date
    Mar 2012
    Posts
    645

    Default

    Hi,

    given that this thread ended up being mainly about the click action in charts, can you please create a new thread for your last question?

    Thanks

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.