tracylee
6th August 2018, 11:16
Hi,

I have customize a new table and new session. How can I display the data on session sort by section and length.
Eg:
-------------------------------------------------------------
| Section | Length | Qty |
-------------------------------------------------------------
| section B | 340 | 2 |
| section B | 103 | 18 |
| section A | 500 | 3 |
| section A | 205 | 10 |
| section A | 40 | 1 |
-------------------------------------------------------------
I wrote a code as below,

|****************** declaration section *********************
declaration:
table ttccus024 | Short Bar List

|******************** program section *********************
before.display.object:
get.record.field.readonly()

|********************** function **************************
Functions:

function get.record.field.readonly()
{
select tccus024.*
from tccus024
where tccus024.sect = :tccus024.sect and tccus024.lgth = :tccus024.lgth
order by tccus024.sect desc, tccus024.lgth desc
selectdo
endselect
}


when run the session is display as below:

-------------------------------------------------------------
| Section | Length | Qty |
-------------------------------------------------------------
| section A | 40 | 1 |
| section A | 205 | 10 |
| section A | 500 | 3 |
| section B | 103 | 18 |
| section B | 340 | 2 |
-------------------------------------------------------------

Please advise.

Sahil Sharma
6th August 2018, 11:42
As per your requirement, the session results are correct.
the data is sorted as per the section first making the length field its subset.

giggty
6th August 2018, 15:08
Consider using query.extend.order("tccus024.sect desc, tccus024.lgth desc") or query.define.sort.order().

tracylee
7th August 2018, 03:49
Consider using query.extend.order("tccus024.sect desc, tccus024.lgth desc") or query.define.sort.order().


Hi,

Thanks for your help. Now can display correctly when using query.define.sort.order().