cancel
Showing results for 
Search instead for 
Did you mean: 

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

Former Member
0 Kudos

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!

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

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.

Loed
Active Contributor
0 Kudos

Hi,

You may now close this thread by clicking the CORRECT ANSWER..

Regards,

Loed

former_member184494
Active Contributor
0 Kudos

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