Friday, December 21, 2012

Cognos Report studio Objects

Difference between Query Calculation and layout calculation

Query Calculation
It is used to perform Data Scrubbing. Insert a query calculation into your report to add a new row or column with values that are based on a calculation. For example, you create a query calculation named Euros that converts dollars to euros by multiplying an existing dollar measure by a conversion rate. Euros can then be displayed to end users in a separate row or column.

Layout Calculation
Layout Calculation is used to provide run time information, but not used to perform any operation on the data. Create a layout calculation to add run-time information to your report, such as current date, current time, and user name. When creating layout calculations, only report functions are available to you in the expression editor. These functions are executed in the report layout, as opposed to the other functions which are executed in the query.
 
 

Difference between Group span & Level Span


Group Span:
In List Report when you have product line product type & product name as a query item. In list object product line & product type are grouped. Now you want to span product line as per product type (i.e. you want product line to repeat whenever new product type is listed beside it). You can click on product line & change the Group Span property to product type. This gives you the proper result.

Now you want to span product line as per product name (i.e. you want product line to repeat whenever new product name is listed beside it). In this case you have to first group the product name query item then & then you can change Group span property of the product line to product name. Because Group span property lists the query items which are grouped in the list.

Level Span:
In CrossTab Report when you have product line as parent node in row product type as child node of product line & product name as child node of product type. Now you want to span product line as per product type (i.e. you want product line to repeat whenever new product type is listed beside it). You dont have Group span property in CrossTab Ok? Here you can do some trick which is called Level span. You can add one more product type as child to product type & then cut product line from CrossTab. Then select Parent product type & change Source Type property to Data Item Value & Data Item Value property to product line. Now run the report you can see the product line level repeats whenever new product type is listed beside it. This is called a Level Span.

NOTE: Remember one more thing you can not do same kind of Level Span using dimensional model. You can do Level Span using relational model only.
 

Render Variable: - Specify a variable based on which object can be conditionally rendered. Style variable is used to hide or show an object.

Style Variable: - Specify a variable based on which object can be conditionally styled. Style variable is used to change the style of an object, different report objects in different styles.

Example  for Style Variable
A report contains a list object, if u want to display every alternate row with particular color
in this case, go to query explorer....
1) create a data item with name running-count with function "running-count" on particular unique column
2) now create one more data item as mod  with function "mod" on that running-count data item.
    Select List and in properties pane. Select 'Properties' and select 'running-count' and 'mod' data items.
3)create a Boolean variable with expression mod=1
4)go to the page select List column Body style
5)In properties pane select Style Variable as Boolean variable 
6)click on YES variable and set its Foreground color as BLUE 
7)click on No variable and set its Foreground color as GREEN 
now run the report 

Example  for Render Variable
In case you want to see the  particular page in HTML or PDF or CSV format then 
1)Create 3 pages in your report 
2)Every page should contain some specific data
3)name these pages as HTML,PDF,CSV
4)create a String variable with 3 values as HTML ,PDF and CSV
5)now in string variable put expression as .....
case
when ReportOutput()='HTML' then 'HTML'
when ReportOutput()='PDF' then 'PDF'
when ReportOutput()='CSV' then 'CSV'
end
6)now go the page named HTML and select page object
7)in properties pane click on Render Variable ,select that string variable
8)check only HTML check box value for HTML page
9)repeat step No. 6 to step No.8 for remaining 2 pages.
 
 
A query item that you can insert anywhere in the layout of your report where there is no query associated. When the report is run, the singleton object retrieves only the first row value for that query. Singletons are useful for adding boilerplate text to a report, such as a company name or address, to add overall calculations in a report, or to add multidimensional cell calculations in a report
 

No comments:

Post a Comment