Saturday 10 December 2011

Highlight alternate rows in WebSphere portlet factory (WPF)

Often, there is a need to highlight alternate rows when displaying the data using page automation builders like data page builder. Highlighting alternate rows also provide better visual presentation for your page and increases readability of the data table.

IBM WebSphere portlet factory provides a very simple technique to add attributes to alternate rows in data table.


You can build this functionality into an HTML template. On any XML node for which an alternating attribute is desired, simply prefix the attribute name with sequence_ (with the underscore) and list the different values for the attribute in a comma-separated list.

For example, in a

tag, to alternate between the HTML class names OddRow and EvenRow, add the following: 

< tr sequence_class="OddRow,EvenRow">
.........

</tr>

This would highlight the alternate rows in the data table. Similarly we, can add any attribute for alternate rows in a data table using page automation builders.

Saturday 26 November 2011

Inter Portlet Communication in IBM WebSphere Portlet factory

While developing any portal application, we need to make portlets talk to each other and exchanging some data between each other.
 In Websphere portlet factory there are several ways to make portlet talk to each other. One of the way to achieve this is Inter Portlet Communication using Property Broker.

Cooperative portlet source builder is used in the source builder to declare the event to be published by source portlet model and Cooperative Portlet target builder is used in Target portlet model .

So for example if we consider a library management portal page having 2 portlets:
  • Books List portlet: This portlet shows a table containing all the fiction books. On clicking on the book label , details of the clicked book is displayed in the books detail portlet.
  • Books Details portlet: This portlet shows the details of the book.

Tuesday 12 July 2011

Fetching nth row in DB2

Few days back I was facing a problem of fetching a large number of rows (approx.70 000) on a very slow client network. So as a solution I decided to fetch rows in small chunks. In DB2 there is a function  row_number() .
An OLAP function ROW_NUMBER() provides consecutive numbers to rows in a result set .For Example:-
SELECT ROW_NUMBER() OVER(), TABNAME FROM SYSCAT.TABLES WHERE TABSCHEMA='DB2ADMIN'

1 TABNAME
-------------------------------------------
1 CONSECUTIVE_NUMS
2 DATES
3 EXPLAIN_ARGUMENT
4 EXPLAIN_INSTANCE
5 EXPLAIN_OBJECT
6 EXPLAIN_OPERATOR
7 EXPLAIN_PREDICATE
8 EXPLAIN_STATEMENT
9 EXPLAIN_STREAM
10 SALES_DETAIL
11 SALES_DETAIL_CLS
11 record(s) selected.

The query to get rows from 11th to 20th row from a table can be:-


Select EMPID, EMPNAME , DESIGNATION from (
select row_number() over (order by EMPID ASC) as EMPID, EMPNAME , DESIGNATION from Employee_data
)where rownumber BETWEEN 10 and 21;


Reference:    Using DB2 OLAP functions

Please provide your feedback on this post by writing comments on this post below.

Tuesday 3 May 2011