2 Replies Latest reply on Dec 18, 2013 11:31 AM by Eric Howard

    JavaScript API - Referencing

    Paul Madani

      Hi guys,

       

      Basically I am using the Tableau 8 JavaScript API for various things. I was wondering if there is an efficient way to reference parameters and filters and use those references later.

       

      1. I have a workbook with many many parameters, calling getParametersAsync() is extremely slow. Is there anyway that I can reference a parameter specifically if I know it's name?

       

      2. If I need to use getParametersAsync(), do I have to iterate through the returned Parameter[] array and test each name to find the parameter I require? I find that referencing based on index is inconsistent.

       

      It would be nice if there way a reference that for these questions.

        • 1. Re: JavaScript API - Referencing
          Nay Lin Soe

          Hi Paul,

           

          I've got a similar issue, though in my case I can't successfully set the parameter value using changeParameterValueAsync(name, value) as I've asked here: Changing Parameter through Javascript API

          My understanding is that the first argument (name) is the name of the parameter however it is not working that way in my attempt.

           

          I would also love to know if there is an efficient way of referencing parameters.

           

          Nay

          • 2. Re: JavaScript API - Referencing
            Eric Howard

            I haven't tested it, but the changeParameterValueAsync() method takes the name of the Parameter as an argument, the value to be changed, and returns a parameter object.  If you know the name of the parameter and the existing/default value of it, I wonder if you could use this function's return value (parameter) to gain the reference you are looking for. I will try to find time to test this in the next week.  If you are able to test this please let us know your results.

             

            I also suggest adding this to the ideas section, as even if this method works, it would be nice to be able to reference objects such as parameters directly as desired in your use case.

             

            http://community.tableau.com/community/ideas

             

            Eric