Tribune

Home » Liferay Portal » English » 3. Development

Vista Combinata Vista Piatta Vista ad Albero
Discussioni [ Precedente | Successivo ]
toggle
Shawn Li
A table report portlet template based on a single SQL statement
1 febbraio 2013 20.13
Risposta

Shawn Li

Punteggio: Junior Member

Messaggi: 47

Data di Iscrizione: 1 febbraio 2013

Messaggi recenti

A single SQL statement actually gives you all the information to create a full-fledged web portlet for a simple table report:

(1) Number of rows.
(2) Number of columns
(3) Column names

Based on XSLT and JSP, I created a table report portlet template based on a single SQL statement.

This is a simple SQL statement running on MySql:



This is a simple table report portlet built within 5 minutes on the template:



This is the xslt style sheet which is built automatically by the template sysytem. You can do further modification for your own need.

Hitoshi Ozawa
RE: A table report portlet template based on a single SQL statement
2 febbraio 2013 3.41
Risposta

Hitoshi Ozawa

Punteggio: Liferay Legend

Messaggi: 8000

Data di Iscrizione: 23 marzo 2010

Messaggi recenti

Are you going to make your portlet available?
Shawn Li
RE: A table report portlet template based on a single SQL statement
2 febbraio 2013 11.39
Risposta

Shawn Li

Punteggio: Junior Member

Messaggi: 47

Data di Iscrizione: 1 febbraio 2013

Messaggi recenti

I will. There is still a long list for to-do. Thanks.
David Ilechukwu
RE: A table report portlet template based on a single SQL statement
2 febbraio 2013 16.47
Risposta

David Ilechukwu

Punteggio: Junior Member

Messaggi: 62

Data di Iscrizione: 7 giugno 2010

Messaggi recenti

Sounds interesting Shawn!
Have you tried running your report with data in one of the rows not containing anythings (is equal to NULL)?
Please keep us posted on how this turns out.

Cheers
Shawn Li
RE: A table report portlet template based on a single SQL statement
2 febbraio 2013 17.07
Risposta

Shawn Li

Punteggio: Junior Member

Messaggi: 47

Data di Iscrizione: 1 febbraio 2013

Messaggi recenti

It handles NULL value well.
My next work is to add soring feature on each column.
By the way, those browse buttons on the table report are supported by JQUERY Ajax.
Shawn Li
RE: A table report portlet template based on a single SQL statement
5 febbraio 2013 9.40
Risposta

Shawn Li

Punteggio: Junior Member

Messaggi: 47

Data di Iscrizione: 1 febbraio 2013

Messaggi recenti

I added sorting button on each column. Sorting is Ajax-driven, and is dynamically created by template based on your SQL statement.

Below is a simple example with a basic UI design:

Shawn Li
RE: A table report portlet template based on a single SQL statement
5 febbraio 2013 13.15
Risposta

Shawn Li

Punteggio: Junior Member

Messaggi: 47

Data di Iscrizione: 1 febbraio 2013

Messaggi recenti

Another good feature about this portlet template:

Whenever you implement it into production, by changing different SQL statement, and data source configuration, without change anything, the portlet which shows report A before change, will start to show report B dynamically.
Shawn Li
RE: A table report portlet template based on a single SQL statement
6 febbraio 2013 11.38
Risposta

Shawn Li

Punteggio: Junior Member

Messaggi: 47

Data di Iscrizione: 1 febbraio 2013

Messaggi recenti

Now the portlet is able to parse those database column names and create better formatted names on report. It also determines automatically the relative percentage of each column's width, so that when the report is browsed through different sorting, the feel and look is keeping the same.

More details of element style is also created.

Shawn Li
RE: A table report portlet template based on a single SQL statement
9 febbraio 2013 21.12
Risposta

Shawn Li

Punteggio: Junior Member

Messaggi: 47

Data di Iscrizione: 1 febbraio 2013

Messaggi recenti

This is the structure of the Eclipse project:

Shawn Li
RE: A table report portlet template based on a single SQL statement
11 febbraio 2013 18.10
Risposta

Shawn Li

Punteggio: Junior Member

Messaggi: 47

Data di Iscrizione: 1 febbraio 2013

Messaggi recenti

Using this template, you can easily make multiple report portlets from mutiple data sources WITHIN MINUTES. Below is one example:

One is from MySql, the other one from Oracle. They are both working beautifully!