Skip to Content
avatar image
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 comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • avatar image
    Former Member
    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 comment
    10|10000 characters needed characters exceeded

    • Former Member

      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...