Hitachi Vantara Pentaho Community Forums
Results 1 to 3 of 3

Thread: Can I store the principalName variable in a javascript variable

  1. #1
    Join Date
    Mar 2006
    Posts
    142

    Question Can I store the principalName variable in a javascript variable

    I am using pentaho version 2.0.0 stable with CDF. I generate SQL statements in my javascript that is part of my template.html

    I pass these SQL statements as string parameters to xactions that use SQLLookups to populate the data for dashboard charts.

    Is there a way within CDF that I can execute my xaction that retrieves the users name for the session (principalName) and have it stored in a javascript variable so that I can use it as part of the SQL statement string parameter that I build.

    So I want to run an xaction from the template.html on startup and have the output stored in a javascript variable that I can refer to later.


    Basically I need to add some SQL based on the principlaName to the WHERE clause portion of my generated SQL statement.

    Example:
    Right now I have javascript in my template.html that does:

    SQLStmnt = "SELECT SUM(Sales) FROM SalesTable " +
    "WHERE Customer = " + jsvarCust;

    I want to do something like:

    SQLStmnt = "SELECT SUM(Sales) FROM SalesTable " +
    "WHERE Customer = " + jsvarCust +
    " AND SalesPerson = " + jsvarPrincpalName;

    jsvarPrincipalName would have the value of the security variable principalName (e.g. "joe")


    Thanks

  2. #2
    Join Date
    Jul 2007
    Posts
    2,497

    Default

    well, no. That's on the todo list, but currently there's no easy way. Usually we used mdx and roles for that; If you use a session var named 'role' it will be used when you do a mdx query.

    apart from that, only if you build an xaction that puts that info in a resultset :S
    Pedro Alves
    Meet us on ##pentaho, a FreeNode irc channel

  3. #3
    Join Date
    Mar 2006
    Posts
    142

    Default

    Ok, I have an xaction that can put it in a result set. But...I am missing exactly what CDF object I would use that xaction with. I wouldn't want this user name displayed anywhere.

    Sorry if this is a stupid questions but how would I execute the xaction and have its result stored in the javascript varibiable ?


    I use roles for the JPivot interfaces I have but many of my dashboard charts are based on SQL queries.

    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.