简体   繁体   中英

How to group rows vertically in PowerBuilder?

I have this sample rows of plate nos with bay nos:

Plate no | Bay no
------------------
AAA111   |   1
AAA222   |   1
AAA333   |   2
BBB111   |   3
BBB222   |   3
CCC111   |   1

Is there a way to make it look like this in a datawindow in powerbuilder?

  1    |   2    |   3
------------------------
AAA111 | AAA333 | BBB111
AAA222            BBB222
CCC111

There isn't an simple answer, especially if you need cells to be update-able.

Variable Column Count Strategy

If the number of columns across the top is unknown at development time than you might get by with a "Crosstab" style datawindow but it would be a display only. If you need updates you'll need to do manual data manipulations & updates as each cell would probably represent one row.

Fixed Column Count Strategy

If the number of columns is known (fixed) you could flatten the data at the database and use a standard tabular (or grid) datawindow control but you'll still need to get creative if updates are needed.

If you use Oracle to obtain the data you can use the Pivot and Unpivot function to perform what you are looking for. Here is an example of how to do it:

http://www.oracle.com/technetwork/es/articles/sql/caracteristicas-database11g-2108415-esa.html

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM