Hitachi Vantara Pentaho Community Forums
Results 1 to 4 of 4

Thread: Query Component

  1. #1

    Default Query Component

    I've a queryComponent which executes a sql query and I'm trying to pass it to an xactionComponent:


    Code:
    MetaLayerHome2 = {
    executeQueryComponentDefinition: {
        ...
        }
        }
    }
    
    
    var executeQueryComponent = 
    {
        name: "executeQueryComponent",
        type: "queryComponent",
        htmlObject: "queryObject",
        executeAtStart: true,
        queryDefinition: MetaLayerHome2.executeQueryComponentDefinition,
        result: "query_result",
        preExecution:function(){},
        postExecution: function(){
            $('#queryObject').html("" + this.result);
        }
    };
    Dashboards.init([executeQueryComponent]);
    
    sample = 
    {
      name: "sample",
      type: "xaction",
      solution: "cdf-samples",
      path: folder01,
      action: "QueryResult.xaction",
      listeners:["query_result"],
      parameters: [["query_result","query_result"]],
      htmlObject: "sampleObject",
      executeAtStart: true,
      preExecution:function(){},
      postExecution:function(){}
    }.....
    How is the query stored in "query_result"?
    I've debugged it and seems to be an array of arrays [["name1", "value1"], ["name2", "value2"], ["name3", "value3"]]...but I don't know what I'm doing wrong.
    Can it be passed to the xaction?

  2. #2

    Default

    Here's something you can try. First remove the line result: "query_result" from your executeQueryComponent definition. I was doing the same thing and I was told that result is not a value you assign, result is where the actual results are stored. So remove that line from you definition. Declare query_result as a global variable. Then in the post execution function of executeQueryComponent assign result to query_result -> query_result = this.result;

    I think that would work, but maybe someone on here with more knowledge can give a better solution.

    Also remove from the post Execute function the line for setting the #queryObject.html.
    Last edited by BobN; 03-19-2009 at 09:55 AM.

  3. #3

    Default

    Thanks, now It works properly.
    I've the query listening to a select component.To make it work correctly I've had to put:
    postExecution: function(){Dashboards.fireChange('query_result',this.result)}

  4. #4

    Default

    hello, can you send me the entire code, please??

    one question more, which cdf version are you using??

    thanks a lot

    KR

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.