Friday, 29 March 2013

Datepicker using javascript UI

Hi Guys,

Finally i cracked How to make use of Javascripts and Javascript UI libraries in cognos .
Advantage of libraries is you have predefined function for almost everything for cognos developers who are not good with javascripts its a blessing.The function covers all scenarios.

Eg -If you have date prompt and you dont use libraries then you have to tell everything like what to do when you click on something how to pass that value to prompt and all those details.But since all this is covered in library be smart and just use library.

What you need 
1) Javascript library
2)Javascript UI library
3)css file -- for how you want look and feel .

Now if you take this files from google directly they load into your browser like all site like facebook and will not be affected by cognos security.You can also place them in cognos server installation directory and use it .But again you need to ask cognos admin team.So load it from google everytime they are so fast and lite you wont know the difference .All major site are using these libraries so dont worry.

How to implement in Cognos 

1) Go to prompt page
2)Take two HTML items and paste the code.
Note -Now you could create input prompt from cognos and use it rather then creating with HTML but the javascript UI library wont work properly .You need to specify what to do when you click on the prompt how to save that value to input prompt and all that .At end of this page i have included a link of blog which tells you that .Its a big script and difficult way to do it.In case you like the hard way :-)

First HTML item


</html>
<head>
</head>
<body>
<p>Date: <input type="text" id="datepicker" /></p>
</body>
</html>


Second HTML Item



<link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/themes/ui-lightness/jquery-ui.css" type="text/css" media="all" />
<style type="text/css">
th.ui-datepicker-week-end,
td.ui-datepicker-week-end {
 display: none;
}
</style>
  <script type="text/javascript"
 src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<script type="text/javascript"
 src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.5/jquery-ui.min.js"></script>
  <script>

var bb = $.noConflict();

bb(document).ready(function(){

 bb(function() {
    bb( "#datepicker" ).datepicker();
  });

alert("the function has run");

});

bb.noConflict();
  </script>



Note - I have hidden wekends with help of CSS styles .Do go through below link for details on what javascript UI can do for you .

JQuery UI Official site



Prompts API for Cognos10

In cognos report studio guide for cognos 10.2 you have javascript function to access prompts these have been addition to cognos 10 earlier cognos did no have its own function for javascripts in 8.4

http://pic.dhe.ibm.com/infocenter/cbi/v10r2m0/index.jsp?topic=%2Fcom.ibm.swg.ba.cognos.ug_cr_rptstd.10.2.0.doc%2Fc_prmpt_api_overview.html


Below is a simple script to assign value to text prompt box using javascript



<script language="javascript" type="text/javascript">

//getFormWarpRequest()._textEditBoxABC.value = 'Golf Equipment';

var fw = getFormWarpRequest();

var bb =fw._textEditBoxABC;

ab.value = 'Golf'

alert ('this is trial');
</script>


Below is a thing to replace the First HTML item .It tells how to pass parameter value selected using Java UI to cognos parameter.

Apart from that create a text box prompt ABC and hide it.You cant pass the value selected in javascript UI to cognos so you pass it to textbox prompt which is a congos prompt and submit that textbox prompt


</html>
<head>
<script language="javascript" type="text/javascript">
function myFunction()
{
var jobValue = document.getElementById('datepicker').value;
// just like that you can remove both jobvalue and alert
alert(document.getElementById('datepicker').value)

//below 4 lines is your actual code
var fw = getFormWarpRequest();
var bb =fw._textEditBoxABC;
bb.value = document.getElementById('datepicker').value;
// if you dont want to autosubmit dont use the below line
promptButtonFinish();

}
</script>
</head>
<body>
<p>Date: <input type="text" id="datepicker"  onchange =myFunction() /></p>
</body>
</html>



Sunday, 10 March 2013

Business Insight Dashboards

Hi Guys,

Business insight dashboards are easy to make .Just drag and drop elements that we want .

Note - If you have 2 reports you drag both of them to dashboard and you want to filter on both based on single filter and both of them do not have common data items .

One very useful property . if you create a query with name _BusinessInsight_  . those are underscores .and place all the items common in them then you can filter . The name of query _BusinessInsight_ is a special and cognos understands it :-)




Saturday, 9 March 2013

Simple Dashboard

Hi Guys,

Below is dashboard using default dashboard property in cognos .Not using business insight.These dashboard were available in cognos 8.4 as well .Go through below link for detailed explaination

Ironside Group-Dashboard

1) create a report with 2 prompts .Year and Region and Very important a finish button .As its a multiselect the prompt values will not get submitted and you wont see any changes

2) Create a chart report and put filter based on this prompts year =?Year? kind . and make them optional











Friday, 8 March 2013

Using Jquery with Cognos

Hi Guys ,

Please go through other article before this it will giv you some basics

Jquery with Cognos

As you are aware cognos has limited functionalities and to improve them we use javascript .However most report authors are not javascript developers so we have a issue .You can make use of jquery to make your life simpler .

We have jquery-UI library which allows you to make your of lot of features like .Sliders , Data prompts and all those flashy things you see on most of website .If your userbase wants that kind of experience with cognos


http://www.htmlgoodies.com/tutorials/forms/article.php/3895776/HTML-Forms-jQuery-Basics---Getting-Started.htm

Below is the javascript for Default date prompt value selection 


<script>
pickerControlPDate.setValue(sysdate )-------- instead of sysdate you can have a function here and write your logic

</script>
-----------------------------------------------------------------------------------------

Below is a script for jquery-UI date picker.Copy it in a notepad and save the notepad as abc.html
it should work



<html lang="en">
<head>
  <meta charset="utf-8" />
  <script type="text/javascript"
 src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<script type="text/javascript"
 src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.5/jquery-ui.min.js"></script>
  <script>
  $(function() {
    $( "#datepicker" ).datepicker();
  });
  </script>
</head>
<body>

<p>Date: <input type="text" id="datepicker" /></p>


</body>
</html>


Cognos 8 Mashup Service


Hi Guys,

This is very interesting stuff .You can now integrate your Cognos report with your regular webapplication .
Example is your internet banking .that is a web application .Consider you have a report showing your expenditure through year on various items .Now that report is made in cognos and is available on cognos portal but you dont even have cognos login you have only bank password . Still you are able to see that cognos report developed by some cognos developer and which is filtered on your account details

Now that is awesome right .You have the all the abilities of cognos into your web application .The web application just calls a webservice that provides you the report .Without the web application bothering about the performance of report , data structure and all that .


IBM Cognos 8 Mashup Service (CMS), a new web service shipped with the 8.4 Platform, is an API (application programming interface) that automatically and securely exposes BI content as a web service for use in operational applications, business process management (BPM) workflows and mashups. With this capability, you now can extend your BI content into existing applications and processes that are critical to your business users as well as add new context by “mashing” content with other applications.

I have not actually used it till now , but we try to use it in future if i get some time and chance.