COGNOiSe.com - The IBM Cognos Community

IBM Cognos 8 Platform => COGNOS 8 => Report Studio => Topic started by: holsy1982 on 26 Jan 2011 03:22:13 AM

Title: Commentary Boxes inputted on reading.
Post by: holsy1982 on 26 Jan 2011 03:22:13 AM
Does anybody know of any method which would allow the reader of a report to add commentary to a report which others would then be able to view.  I don't want to allow the user access to Report studio, I'd much rather that when he views he can add them and save them.

(I should probably note that I'm currently using Cognos 8.1)
Title: Re: Commentary Boxes inputted on reading.
Post by: holsy1982 on 28 Jan 2011 04:01:15 AM
I managed to complete this using a PHP script which saves the comments to a local Mysql server.  This is then displayed using a HTML item within Cognos.

The only thing I'm currently trying to do is to change the URL the HTML item runs dependant upon who is reading the report.  This will allow me to give or deny access to changing the comments dependant upon the users details

ie if username = 'Bob' then URL = http://intranet/cognos_utils/Commentary.php?allow_submit=1' else 'http://intranet/cognos_utils/Commentary.php?allow_submit=0'
Title: Re: Commentary Boxes inputted on reading.
Post by: melee on 28 Jan 2011 09:59:31 AM
Ahhh! PHP and MySQL... Now you're speaking my language. I'd approach this using AJAX and a POST request.

You're going to need to output the name of the user somewhere on the report - just use a singleton, shouldn't be too big of a deal. Use Javascript to transverse the document and grab their name. POST the name variable to your script, where you can use IF logic to determine whether or not there should be an edit button. I'd imagine it would go something like this:


<?php

// Assuming Bob can edit
if ($_POST['user']) {
echo 
$commentStream;
     if (
$_POST['user'] == 'Bob') {
          echo 
$commentEditCode;
     }
}

?>



All you would need to do at that point is inject the HTML from the form back into the HTML item.