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.

Saturday, 16 February 2013

Governors in framework manager

Hi Guys ,

Below is screenshot of governor setting in framework .Please feel free to add your comments on each settings .I will add my notes each time i come across any special case .



Cardinalities in Cognos framework

Hi Guys,

Below is note on cardinalities .I have taken the content from IBM cognos helpguide .You can find the same in cognos framework userguide .Just noting down point for my reference .

taken from IBM

IBM helpguide Link

Cardinality in Generated Queries

IBM Cognos 8 supports both minimum-maximum cardinality and optional cardinality.
In 0:10 is the minimum cardinality, 1 is the maximum cardinality.
In 1:n , 1 is the minimum cardinality, n is the maximum cardinality.
A relationship with cardinality specified as 1:1 to 1:n is commonly referred to as 1 to n when focusing on the maximum cardinalities.

Note --- so 0:1 to 1:n is also read as 1 to n

A minimum cardinality of 0 indicates that the relationship is optional. You specify a minimum cardinality of 0 if you want the query to retain the information on the other side of the relationship in the absence of a match. For example, a relationship between customer and actual sales may be specified as1:1 to 0:n. This indicates that reports will show the requested customer information even though there may not be any sales data present.
Therefore a 1 to n relationship can also be specified as:
  • 0:1 to 0:n
  • 0:1 to 1:n
  • 1:1 to 0:n
  • 1:1 to 1:n
Use the Relationship impact statement in the Relationship Definition dialog box to help you understand cardinality. For example, Sales Staff (1:1) is joined to Orders (0:n).

It is important to ensure that the cardinality is correctly captured in the model because it determines the detection of fact query subjects and it is used to avoid double-counting factual data.
When generating queries, IBM Cognos 8 follows these basic rules to apply cardinality:
  • Cardinality is applied in the context of a query.
  • 1 to cardinality implies fact data on the n side and implies dimension data on the 1 side.
  • A query subject may behave as a fact query subject or as a dimensional query subject, depending on the relationships that are required to answer a particular query.


    Possible end labels are
    • 0..1 (zero or one match)
    • 1..1 (exactly one match)
    • 0..n (zero or more matches)
    • 1..n (one or more matches)
    The first part of the notation specifies the type of join for this relationship:
    • an inner join (1)
      An inner join shows all matching rows from both objects.
    • an outer join (0)
      An outer join shows everything from both objects, including the items that do not match. An outer join can be qualified as full, left, or right. Left and right outer joins take everything from the left or right side of the relationship respectively and only what matches from the other side.

      Example

      Cardinalities are set according to reporting needs and are not necessarily based on data .Consider below example .Which will require a full outer join.

      Consider example of sold date and product .there might be dates when no product were sold and there can be product which were never sold .so the cardinality shoud be 0:n :0:n (Full outer join)

      but in actual case we want to see only products that were sold so we have 1:1 to 1:n we can also model it to outer join 0:n to 1:n base on requirement