Focal Point
[SOLVED] Sort the second column.

This topic can be found at:
https://forums.informationbuilders.com/eve/forums/a/tpc/f/7971057331/m/4227048666

January 21, 2014, 06:34 PM
hainguyen
[SOLVED] Sort the second column.
Whenever we sort fields, those fields will be put at the first columns. How can I sort second column and keep the first column as original?

This message has been edited. Last edited by: hainguyen,


WebFOCUS 7.7.03
Windows, All Outputs
January 21, 2014, 10:53 PM
jvb
Multiverb report can be a workaround.Please review the sample code below, this may help:
TABLE FILE CAR
SUM
MODEL
BY COUNTRY
PRINT
CAR
ON TABLE SET STYLE *
TYPE=REPORT, COLUMN=CAR, SEQUENCE=1, $
TYPE=REPORT, COLUMN=MODEL, SEQUENCE=2, $
TYPE=REPORT, COLUMN=COUNTRY, SEQUENCE=3, $
ENDSTYLE

END


WF 8.1.04,Infoassist,Oracle, Excel, PDF,HTML.
January 22, 2014, 02:47 AM
Danny-SRL
JVB,
quote:

SUM
MODEL
BY COUNTRY
PRINT
CAR

This won't work because you must repeat the sort fields in a multi-set request.

hainguyen,
Here is a simple solution:
  
TABLE FILE CAR
PRINT
COUNTRY
CAR
SALES
BY CAR NOPRINT
END

Here is a more complex one:
  
TABLE FILE CAR
PRINT
COUNTRY NOPRINT
COMPUTE XCOUNTRY/A10=IF COUNTRY EQ LAST COUNTRY THEN ' ' ELSE COUNTRY; AS COUNTRY
CAR NOPRINT
COMPUTE XCAR/A16=IF CAR EQ LAST CAR THEN ' ' ELSE CAR; AS CAR
SALES
BY CAR NOPRINT
END



Daniel
In Focus since 1982
wf 8.202M/Win10/IIS/SSA - WrapApp Front End for WF

January 22, 2014, 03:49 AM
Wep5622
Apparently your first field is in some sort order that you like, but didn't specify explicitly.
The solution is to explicitly specify the sort order of your first field and then apply the sorting on your second field.

Sometimes that requires computing a sort field for the first field and use that as the first BY field with a NOPRINT to hide it.

For example:
TABLE FILE CAR
PRINT
	MODEL
	COMPUTE SORT/I3 = LAST SORT + 1; NOPRINT
BY TOTAL SORT NOPRINT
BY COUNTRY
BY CAR
END



WebFOCUS 8.1.03, Windows 7-64/2008-64, IBM DB2/400, Oracle 11g & RDB, MS SQL-Server 2005, SAP, PostgreSQL 11, Output: HTML, PDF, Excel 2010
: Member of User Group Benelux :
January 22, 2014, 10:36 AM
hainguyen
Thanks a lot for all suggestions. I tried the simple solution of Danny and it works great. Simple but effective.


WebFOCUS 7.7.03
Windows, All Outputs
May 18, 2015, 09:21 PM
getit
In Dannys example,

 

TABLE FILE CAR
PRINT
COUNTRY NOPRINT
COMPUTE XCOUNTRY/A10=IF COUNTRY EQ LAST COUNTRY THEN ' ' ELSE COUNTRY; AS COUNTRY
CAR NOPRINT
COMPUTE XCAR/A16=IF CAR EQ LAST CAR THEN ' ' ELSE CAR; AS CAR
SALES
BY CAR NOPRINT
END

 


How do we turn off the borders for the COLUMNS COUNTRY AND CAR AND display them like when we use the BYDISPLAY off.?


App Studio Version 8202
windows Platform
SQL Server 2008/2012