Skip to Content
author's profile photo Former Member
Former Member

Please help! - How to pass a BW variable into JavaScript?

I have read everything on the web regarding this topic but found no working solutions. Can someone please help me write a JavaScript function that reads a value of a BW variable used in a DataProvider? I have tried everything, including advice posted in one of the blogs which is often quoted here as a solution, but nothing seems to be working. Please help me!

Add a comment
10|10000 characters needed characters exceeded

Related questions

1 Answer

  • author's profile photo Former Member
    Former Member
    Posted on Jul 10, 2015 at 03:08 PM

    Ok. I think I figured it out, so I am giving my solution below.

    I have created an infofield INFO_FIELD_ITEM_1 and bound my variable to it so that it is displayed when I execute my template (although it can be hidden if necessary). As far as I am aware, using and infofield is the only way to pass the value of the variable into our WAD template.

    I managed to retrieve the value of the variable from the infofield using the following function:

    function GetMyName(){

    var x = document.getElementById("INFO_FIELD_ITEM_1_unid1").getAttribute("value");

    alert(x);

    }

    To test it, I bound the JS function to a button item, but obviously it can be used in other ways.

    Hope that helps someone!

    A.

    Add a comment
    10|10000 characters needed characters exceeded

    • Lukas,

      the only way you can get a variable value to a javascript variable is if you have it on screen. if you are passing to another BW query - you can use the RRI option and call the RRI Receiver through the URL and the values will get passed.

      My knowledge on the WEB API is rusty but remember doing something like that...

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.