Thursday, August 30, 2007

DWH-BI-COGNOS/Report Studio -- use HTML item to get current user

This is an example of using a javascript function in a Cognos Report Studio report to get the current user.Create a new report in Cognos Report StudioCreate a new prompt page and add a HTML item control to the page.Add the following .js code to the HTML itemWhen the form loads you should see an alert box with the current logged in username
function init(){ getFormElements()}function getFormElements(){ for (i=0; i if(document.forms["formWarpRequest"].elements[i].name == "ui.username"){ alert('THIS IS THE USER: ' + document.forms["formWarpRequest"].elements[i].value); } }}

No comments: