Focal Point
[SOLVED] How to make alpha items appear in a list before numeric items

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

July 11, 2013, 10:55 AM
kitten
[SOLVED] How to make alpha items appear in a list before numeric items
I have a list of items, that are both alpha and numeric. By default the alpha items appear last in the list. How can I have them appear before the numeric items.

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


WebFOCUS 7.6.2, MS Windows Server/______, Excel, PDF, HTML
July 11, 2013, 10:58 AM
Doug
You can set a variable (&AlfNum = IF ... THEN ... ELSE ...) or field (AlfNum/A1 = IF ... THEN ... ELSE ...) to check for alpha / numberic and sort (NOPRINT) on that first.

What's your source (TABLE or DM)? Can you provide a sample?
July 11, 2013, 11:17 AM
RSquared
Have you tried changing the sequencing to Descending order?
/* BY feild DESC
*/


WF 7.6.11
Oracle
WebSphere
Windows NT-5.2 x86 32bit
July 11, 2013, 11:45 AM
j.gross
So you want your reports' sort sequence to resemble EBCDIC collation sequence.

It should be sufficient to group the values according to the first character, and allow ASCII order to take it from there. Just DEFINE:
 myInit/A1 = EDIT(myField,'9');
 mySort/A1= IF myInit GE '0' AND myInit LE '9' THEN 'A'
       ELSE IF myInit GE 'A' AND myInit LE 'Z' THEN '0'
       ELSE IF myInit GE 'a' AND myInit LE 'z' THEN '0'
       ELSE myInit;
and sort your report
BY mySort NOPRINT
BY myField



- Jack Gross
WF through 8.1.05
July 11, 2013, 11:48 AM
Francis Mariani
I would use Doug's idea. In this example, I isolate the first character of MODEL and determine if it's alpha or numeric:

DEFINE FILE CAR
MODEL1/A1 = SUBSTR(20, MODEL, 1, 1, 1, 'A1');
ALPHA_NUM/A1 = IF CHKFMT(1, MODEL1, '9', 'I6') EQ 0 THEN 'N' ELSE 'A';
END

TABLE FILE CAR
SUM
SALES
BY ALPHA_NUM NOPRINT
BY MODEL
END



Francis


Give me code, or give me retirement. In FOCUS since 1991

Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server
July 12, 2013, 03:27 AM
Alan B
If you want to have this sort sequence permanently on your system, this can be achieved by following this document


Alan.
WF 7.705/8.007
July 12, 2013, 12:23 PM
kitten
Doug and Francis's solution worked perfect. Thanks to all of you. This forum is really great and you guys ROCK!!!!!


WebFOCUS 7.6.2, MS Windows Server/______, Excel, PDF, HTML
July 12, 2013, 12:26 PM
kitten
Thanks for the docs Alan, didn't know that could be done.


WebFOCUS 7.6.2, MS Windows Server/______, Excel, PDF, HTML