Thursday, August 1, 2013

Technique show multiple rows in one single row with comma separate without using Repeater Controls

For example you have two columns in database School and Grades  like below

School                Grade
======             ========

M105                    01
M105                    02
M105                    03
M105                    04
M205                    05
M205                    02                    
M205                    01


And if you want to show these as a comma separated values like

School                 Grade
=======             ========
M105                    01,02,03,04
M205                    01,02,05

To achieve this with out using the repeater control in report to avoid performance issues follow this technique by creating a data source query subject in FM and use that in the report.

Oracle:

select
SCHOOL.SCHOOL_CODE ,
( listagg(SCHOOL.GRADE_NUMBER_CODE,', ')  within group

(order by SCHOOL.GRADE_NUMBER_CODE))  AS "GRADE"

from
ODS.SCHOOL  SCHOOL

group by

SCHOOL.SCHOOL_CODE


Enjoy
Kishore


Friday, July 12, 2013

Recovering the Cognos Framework Manager Project File cpf file from existing Package

Recovering the Cognos Framework Manager Project File cpf file from existing Package




How often in our projects do we loose the cpf file and we have the package on the cognos server.
Here is a simple step to recover the cognos cpf file.

Steps :
1. Create a new file
<Cognos_Installed_location>/configuration/CQEConfig.xml:

<?xml version="1.0" encoding="UTF-8" ?>
<configuration company="Cognos" version="0.1" rendition="cer2"> 

<component name="CQE">
<section name="General Options">
<entry name="KeepModelXML" value="1" />
</section>
</component>
</configuration> 


2. Restart the Cognos server.
3. There is a package known as Sales Order in Public Folder; we dont have cpf file for this.
4. Open Cognos Report Studio and create a new report on the same package.
5. Run the report.
6. A new xml file will be created under <Cognos_Installed_location>/data/cqe/RTModels 7. 7. Rename this file as model.xml
8. Open Framework Manager and create a new empty project.
9. Close Framework Manager.
10. Locate this Framework Manager project and replace the model.xml with our xml from RTModels.
11. Open the project and your cpf is generated; have fun.


Note: I copied this one from others blog but it is very good approach.

Thursday, March 21, 2013

Cognos FM Interview Questions and Answers


                                                   Framework Manager Questions
1.     What is Loop in FM

     Loop is a bottleneck in FM and we should avoid it using Alias or shortcut.
Loop: loop is a closed path (relation) that exists among 3 (or) more tables. For example, if we have '3' tables T1, T2, T3 then, a loop exists among these tables only when we create joins in the following fashion:
         Loop:          T1 ---> T2 ---> T3 ---> T1
To resolve the above problem, we have to create a shortcut (or) Alias to the Table T1.
         No Loop:      T1 ---> T2 ---> T3 ---> Alias (or) Shortcut of T1
2.    Determinants
Determinants are a feature of Cognos 8 designed to provide control over granularity.  Determinants are used to avoid double counting. Determinants are most closely related to the concept of keys and indexes in the database. There is no concept of hierarchy in determinants, although the order in which they are specified does govern the order in which they are evaluated.
          When do I need to use Determinants? Joins at multiple levels of granularity on a single query subject
         A classic example of this is the Time dimension in Go Data Warehouse. There are joins to the
   
        Time dimension on the day key and on the month key.
        This is mainly an issue when doing multi-fact querying and you need to prevent double counting.
             Example 1: Time Dimension (Unique foreign keys)
Year Key
Month Key
Month Name
Day Key
Day Name
2005
200501
Jan 05
20050101
Sunday, Jan 1, 2005
2005
200502
Jan 05
20050102
Monday, Jan 2, 2005
            It is possible to define three determinants for this data set, two non-unique determinants (Year and  
            Month) and one unique determinant (Day).
          
          Interpretation:
Day key is the unique key of the table therefore you can associate all the columns in the table to this key. Because it is a unique key, we check the Uniquely Identified box and do not check the Group By. Group By is a property that we do not need when data is unique.
 Month key is also a key but is not unique, so the Uniquely Identified box is not checked for this    determinant. However, the Month Key is all that is needed to identify a month in the data. If you wanted to query month from this time table you would write a query that used select distinct syntax and grouped by Month key since the values are repeated, this is why we check the Group By box.
Similar logic applied to the Year determinant.

3.    Star and Snow Flake schema
Star Schema: It has single fact table connected to dimension tables like a star. In star schema only one join establishes the relationship between the fact table and any one of the dimension tables. A star schema has one fact table and is associated with numerous dimensions table and depicts a star.

Snowflake Schema: It is an extension of the star schema. In snowflake schema, very large dimension tables are normalized into multiple tables. It is used when a dimensional table becomes very big. In snow flake schema since there is relationship between the dimensions Tables it has to do many joins to fetch the data. Every dimension table is associated with sub dimension table.
The
main difference between star schema and snowflake schema is that the star schema is highly denormalized and the snowflake schema is normalized. So the data access latency is less in star schema in comparison to snowflake schema. As the star schema is denormalized, the size of the data warehouse will be larger than that of snowflake schema.
Performance wise, star schema is good. But if memory utilization is a major concern, then snow flake schema is better than star schema.
A dimension table will not have parent table in star schema, whereas snow flake schemas have one or more parent tables.
The dimensional table itself consists of hierarchies of dimensions in star schema, whereas hierarchies are split into different tables in snow flake schema. The drilling down data from top most hierarchies to the lowermost hierarchies can be done.
4.    Normalization and De – Normalization
Normalization is the process of reducing data redundancy and maintains data integrity. This is performed by creating relationships among tables through primary and foreign keys. Normalization procedure includes 1NF, 2NF, 3NF, BCNF, and then the data is normalized.
Denomalization on the contrary is the process of adding redundant data to speed up complex queries involving multiple table JOINS. One might just go to a lower form of Normalization to achieve Denormalization and better performance. Data is included in one table from another in order to eliminate the second table which reduces the number of JOINS in a query and thus achieves performance.
         
          Steps of normalization:
First Normal form
Entities of the table must have unique identifier or entity key.
Second Normal Form
All the attributes of the table must depend on the entity key for that entity.
Third Normal Form
All attributes that are not part of the key must not depend on any other non-key attributes.
5.    Governor settings.
Governors setting is used to reduce system resource requirements and improve performance. You set
governors before you create packages to ensure the metadata in the package contains the specified
limits. All packages that are subsequently published will use the new settings.
There are a number of governors that you can set. Governor settings in the model can be
overridden by governor settings in Report Studio.

1. Report Table Limits
You can control the number of tables that a user can Retrieve in a query or report

          2.Data Retrieval Limits
You can control the number of rows that are returned in a query or report
          3. Query Execution Time Limits
You can limit the time that a query can take
          4. Large Text Items Limit
You can control the character length of BLOBS (binary large Objects) that a user can retrieve in a
query or report
5.    Allow Enhanced Model Portability at Run Time
    You can use a separate but structurally similar data source at run time. The database schema must be   
    the same between the two data sources.
6.    Allow Usage of Local Cache Select this governor to specify that all reports based on
this model should use cached data.
7.    Outer Joins
You can control whether outer joins can be used in your query or report.
8.Cross-Product Joins
 You can control whether cross-product joins can be used in your query or report.
9.Use With Clause When Generating SQL
You can choose to use the With clause with Cognos SQL if your data source supports the With
clause.
8.    Star Schema groupings
           When you create a star grouping, a new namespace is automatically created for you and all the     
           dimensions in that namespaces are shortcuts to the original dimensions. 

           This way you can have a dimension with all its calculated items, etc. and use it in many different star    
           groupings. That is the whole purpose is to have conformed dimensions being used with multiple facts. 
9.    Alias & Shortcut
           Alias cannot be refreshed when base query updated, but short cut will be refreshed.
A shortcut is a pointer to another entry such as a report, report view, folder, job, agent, page, or URL. You can use shortcuts to organize information that you use regularly. For example, if you frequently use a report in Public Folders, you can create a shortcut in My Folders.

Alternatively, you could create shortcuts as the aliases to the
data source query subject and create your relationships to the shortcuts. To create an alias shortcut, right-click on the query subject it will reference and choose Create Alias Shortcut from the context menu.
a shortcut is always a pointer to another object to which our shortcut points to.

But in contrast, an Alias (shortcut) is a second copy of the original object and, since this is a just copy and not the actual object, any change made in the original object is not reflected in this one.
10. Stitched Query
When we have multi facts objects involved in our report, Cognos will generate two separate queries with each Fact table and combine them with FULL OUTJOIN. These queries are called Stitched queries.
          If you are trying to model a full outer join involving two fact tables related through a common
          Dimension table, note that Cognos 8 will handle such situations using a stitch query.
 
          A query that uses multiple facts from different underlying tables is split into separate queries for
          each underlying fact table. Each single fact query refers to its respective fact table as well as to the
          Dimensional tables related to that fact table. Another query is used to merge these individual queries
          into one result set. This latter operation is generally referred to as a stitched query. You know that
          you have a stitched query when you see coalesce and a full outer join.


11. Cardinality
12. Security
                 Package
                 Object
                 Data
                 Row Level
13. Parameter maps
14. Session parameters
15. What is DMR models.
       
16. Conformed dimensions
       Confirmed dimensions are the dimensions which can be used in multiple star schemas. The dimensions   
       which is used more than one fact table is called conformed dimensions. the dimensions which are used   
       across multiple data marts are called as conformed dimensions. Dimesnsions, which are reusable.
17. Multi fact multi grain
      Multiple-fact, multiple-grain queries in relational data sources occur when a table containing dimensional     
      data is joined to multiple fact tables on different key columns. 
 
      A dimensional query subject typically has distinct groups, or levels, of attribute data with keys that     
      repeat. The IBM® Cognos® studios automatically aggregate to the lowest common level of granularity 
      present in the report. The potential for double-counting arises when creating totals on columns that 
     contain repeated data. When the level of granularity of the data is modeled correctly, double-counting can 
     be avoided. 
 
    Note: You can report data at a level of granularity below the lowest common level. This causes the data of    
    higher granularity to repeat, but the totals will not be affected if determinants are correctly applied.

18.  what is dynamic cube? 
19. . What is the usage propperity?
 




Wednesday, March 20, 2013

Data Security IN Cognos FM using Parameter Maps and Session Parameter

Data level security using parameter maps and session parameters . 

1. Create parameter map Security_map



2.  Filter Expression in Query subject to filter Budget_code query item based upon user Name session parameters.


Wednesday, March 6, 2013

Implement Row Level security in FM




Requirement: Employee Detail Query subject contains sensitive data like employee salary, vacation days, sick days, etc. we want to restrict user who logged in to see data belongs to him or her only.

Approach: to solve this, we need to create security filter in filter tab of this Query subject. This filter will comprise of Parameter map, macros and session parameters. 
















Staff key in this Query Subject uniquely identifies each employee but it doesn’t match LDAP user name. so we need to create Parameter Map name “security_map”. We can also import list to populate list and values in parameter map. you can get this list from LDAP directory server.












Now apply filter in Filter Tab of Employee Detail Q.S.

















If you want to see session parameter values, go to Project Menu and click on Session Parameters.

















The completed SQL will look like this:






















Now, confirm result by logging on as different users.  Rdogra, MBhatankar,kdirisala







                                                                          

Tuesday, February 26, 2013

Split the String into columns

If you have string coming from your database which has separated by some special character and you want to split that string into multiple columns, follow the below technique.

For example  one of the value from the string is 'The;Name;is;Kishore;Dirisala'  and the name of the data item is [Full]

Full :'The;Name/is;Kishore;Dirisala' 


1 : substring([Full], 1, position('/',[Full] )-1) 
A : substring( [Full], position( '/', [Full] )+1) 
2 : substring([A],1,position('/',[A] )-1) 
B : substring( [A], position( '/', [A] )+1) 
3 : substring([B],1,position('/',[B] )-1) 
C : substring( [B], position( '/', [B] )+1) 
4 : substring([C],1,position('/',[C] )-1) 
D : ubstring( [C], position( '/', [C] )+1) 
5 : substring([D],1,position('/',[D] )-1) 

Then bring then into a list object. A,B,C,D and E should give you what you 
want. 


The Final out put will be like below

1: The
2: Name
3:  is
4: Kishore
5: Dirisala


                                                                                                                                          ---Enjoy

Monday, February 11, 2013

Model Version in Framework Manager





The way the versioning work is as follows - assuming you have versioning 
set to 3 

  • publish your package - version 1 
  • create reports - these reports will use package version 1 
  • publish the package - version 2 
  • create reports - these reports will use package version 2 
  • open reports which are using package version 1, these reports will validate with package version 2, and if saved will use package version 2 
  • publish your package - version 3 
  • create reports - these reports will use package version 3 
  • open reports which are using package version 1 or package version 2, these reports will validate using package version 3 and if saved will 
  • use package version 3 
  • publish your package - version 4 , this will overwrite version 1 of your package, so any reports using version 1 will now use package version 4 (the current package) 

I hope this helps. Most clients set version to 0 during development as 
this will only store 1 version of the package which will always be the 
current version!

Thursday, January 31, 2013

Script for Automation of Cube Building

Cube Building Script


The below code will help to automate your cube building process in Windows.


@echo on
  C:


cd "C:\Program Files\IBM\cognos10TF\bin\"

Cogtr.exe   -n -s "C:\Documents and Settings\rdogra\Desktop\ORO-DRS new approach\ST3 Financial\DRS ST3\FAMIS Expenditure Report.pyj"

cd "C:\Program Files\IBM\cognos10TF\bin\"

Cogtr.exe   -n -s "C:\Documents and Settings\rdogra\Desktop\ORO-DRS new approach\ST3 Financial\DRS ST3\FAMIS Expenditure Report 2012.pyj"


@echo off

xcopy "S:\Kishore\internal eeo.mdc" "S:\Rahul Dogra" /c/d/i/y

exit

Wednesday, January 30, 2013

Cognos 10.X Online Training


ONLINE COGNOS TRAINING

Cognos Course Content:


1.Introduction to Data warehousing (DWH) 

  • Introduction to DWH 
  • Characteristics of DWH 
  • OLTP Vs OLAP Databases 
  • Different Approaches of DWH (Kimball Vs Inmon) 
  • Data mart Vs Data Warehouse 
  • Fact Table Vs Dimension Table 
  • Concepts of Schemas (Star schema & Snowflake schema) 
  • Industry leading ETL and Reporting tools 

2. Introduction to Cognos 

* About Cognos 8.4
* 3 – Tier Architecture
* Cognos Release (EP series7, Reportnet , Cognos 8.0/8,1/8.2/8.3)
* Features of Cognos 8.4
* Cognos Vs other OLAP tools
* Cognos components (Modeling & Reporting)
* Different cognos services

3.Cognos Connections 

* Personalize cognos connection
* Create and manage portals, shortcuts, report views.etc
* Working with Cognos configuration, content Store
* How to Connect to different Data Sources
* Security setup
* Import and Export of Package (Deployment)
* Running the Report Burn
* Scheduling Reports

4.Framework Manager 

* About Framework Manager
* Framework Manager, Metadata Modeling
* Creation of Interface and Usage
* Creating Model & Namespace (Layers)
* Importing Metadata
* Naming convention for objects in a project
* Creating Query Subjects & Query Items
* Merging Query Subjects
* Creating Relationships & Setting Cardinalities
* Creating Parameter Maps & Macros
* Creating of Model Filters, Prompts & Calculations
* Add Business Rules and Set Governors
* Assigning package level security
* Improving performance
* Publishing Package

5.Query Studio 

* Introduction
* About Ad-hoc Reports
* Types of Report(List, Cross Tab, Chart Reports & Others)
* Applying Filters, Prompts & Calculations
* Sorting, Grouping, Sections & Aggregate Functions
* Run and Manage reports

6.Report Studio 

* Type of Report Templates
* Creating list, Cross Tab, Chart, repeater, Maps & Other Reports
* Report templates, formatting Reports – fonts, style, header, footer, boarder…etc
* Generating and Creating Prompt Page
* Types of Prompts
* Query Calculations & Layout Calculations
* Static Filters and Dynamic Filters
* Conditional Block
* Conditional Formatting
* Master Details
* Cascading Prompt
* HTML Items & Hyperlinks
* Set Operators
* Setting Burst Options
* Drill through
* Drill up & Drill down
* Setting Variables
* Report Functions
* Report Validation
* Reports Run with Options (separate course not included in this package)

7.Analysis Studio 

* Insert Data
* Change the number of Visible Items
* Nest Data
* Replace Data
* Sort Data
* Explore Data
* Change the measure
* Drill down for Details
* Hide Items
* Insert a calculation
* Save a custom set
* Define a filter
* Compare sets of data
* Using Dynamic Context

8.Event Studio 

* Creating Agents
* Adding Event conditions
* Task and Task execution rules
* Scheduling Agents 

Text Box prompt with Comma Seperated Values in Cognos 8.x

The following technique allows users to enter comma separated values into a text box prompt.

Use a filter expression to parse out the values. For example, a report has a prompt with parameter ?Id? and is used to filter query item [Id]

The filter expression would be as follows:

cast([Id],varchar(200)) in ( #csv ( split(' ', split(',', split(' ,', split(' , ', split(', ', prompt('Id','token') ) ) ) ) ) ) # )


  1. This filter converts the Id to text and looks for the value IN a list of comma separated values.
  2.  Due to the nature of the macro functions, the result of the function is a series of string elements. 
  3. The cast function applied to a numeric field ensures that the appropriate data types are being used within the filter expression. 
  4. The split() macro functions are in place to handle additional white space that users may enter between the comma-delimited values. 
  5. It allows you to enter multiple Order Numbers separated by commas, in a text box prompt.


when  you runt he reports it asks you to enter the values in text box prompt.
there enter 1,2,3 and then click on finish

it will give the data for Ids 1,2 and 3.