Focal Point
[SOLVED] Sorting a By field in desending order

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

April 01, 2011, 03:47 AM
Arpita
[SOLVED] Sorting a By field in desending order
Hi,
I want to generate a report on the basis of a By field in desending order.
But when i am using Highest command, i am not getting the expected result.
The field is in A4 format.

Anyone can Please Advice.
It will be very helpul.

Thanks in advance.

Thanks
Arpita

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


WebFOCUS 7.6
Windows, All Outputs
April 01, 2011, 05:43 AM
FrankDutch
Arpita

HIGHEST should be in capitals

Why dont you start posting the code you have ?

Did you try it on the CAR or EMPLOYEE database




Frank

prod: WF 7.6.10 platform Windows,
databases: msSQL2000, msSQL2005, RMS, Oracle, Sybase,IE7
test: WF 7.6.10 on the same platform and databases,IE7

April 01, 2011, 09:28 AM
FrankDutch
quote:
HIGHEST.CLK_STN_FINAL


I would not put a dot in between.

And I think when you leave the word HIGHEST out it should also work.
The BY field defaults does a alpabetic sorting.
Highest is only used for number if you want the highest on top.




Frank

prod: WF 7.6.10 platform Windows,
databases: msSQL2000, msSQL2005, RMS, Oracle, Sybase,IE7
test: WF 7.6.10 on the same platform and databases,IE7

April 01, 2011, 09:31 AM
FrankDutch
BTW do they celebrate the 1ste of April in your country?




Frank

prod: WF 7.6.10 platform Windows,
databases: msSQL2000, msSQL2005, RMS, Oracle, Sybase,IE7
test: WF 7.6.10 on the same platform and databases,IE7

April 01, 2011, 10:02 AM
Arpita
Hi Frank,
Thanks for your reply.
By mistake, i have put that dot.
I have tried without dot also, but not getting the result.

Can you please suggest any syntax.

And Frank we don't celebrate 1st April in my country(India).

Thanks
Arpita


WebFOCUS 7.6
Windows, All Outputs
April 01, 2011, 02:04 PM
FrankDutch
leave out all the other BY statements and see what the result is.

And what is the sequence of the result?




Frank

prod: WF 7.6.10 platform Windows,
databases: msSQL2000, msSQL2005, RMS, Oracle, Sybase,IE7
test: WF 7.6.10 on the same platform and databases,IE7

April 02, 2011, 11:15 AM
George Patton
[The error of my ways has been pointed out by Frank, below. I humbly accept the public tongue-lashing! The reasoning in the following paragraphs is exactly backwards - man, what was I thinking! .... I haven't been smoking anything either....

Arpita does need the BY HIGHEST (without any dots) if he wants the PTT1 sort to appear before the PAG1 sort. BY, alone, of course sorts from lowest to highest. You need the BY HIGHEST to get the reverse sort. My apologies! The original post, with all the mistakes, follows:]
..............................................

Take out the HIGHEST all together. BY (without any HIGHEST) automatically sorts from highest to lowest. HIGHEST is redundant in this case. You only need BY HIGHEST to specify a specific number of records to select, e.g.:

BY HIGHEST 10 CLK_STN_FINAL

will give results for the first 10 instances of the sort field and ignore the rest.

In contrast, BY LOWEST has to be used for reverse sorting or, with the number parameter, can be used to select the lowest X instances of the sort field.

This message has been edited. Last edited by: George Patton,


WebFOCUS 7.7.05 Windows, Linux, DB2, IBM Lotus Notes, Firebird, Lotus Symphony/OpenOffice. Outputs PDF, Excel 2007 (for OpenOffice integration), WP
April 02, 2011, 05:47 PM
FrankDutch
George

you are not right

If you do a by it sorts from 1 to 9 and a to Z




Frank

prod: WF 7.6.10 platform Windows,
databases: msSQL2000, msSQL2005, RMS, Oracle, Sybase,IE7
test: WF 7.6.10 on the same platform and databases,IE7

April 03, 2011, 09:41 AM
George Patton
Dag Frank!

OOPS ! My bad! Blame it on jet-lag.

Of course BY alone sorts from Lowest -> Highest. So the reasoning in my earlier post is exactly backwards!

You suggested leaving out the HIGHEST in an earlier post! That's what got me thinking about this in the first place.

As always one has to know what the data looks like. In this case it appears that the data in the field in question always has a capital letter in the first position so the issue of 0 -> 9 and a -> z doesn't arise.

So if Arpita wants the PTT1 sort to appear before the PAG1 sort then he does need to use BY HIGHEST (without any dot).

In his second sort (which he has commented out)it is the word LOWEST that is redundant.

This message has been edited. Last edited by: George Patton,


WebFOCUS 7.7.05 Windows, Linux, DB2, IBM Lotus Notes, Firebird, Lotus Symphony/OpenOffice. Outputs PDF, Excel 2007 (for OpenOffice integration), WP
April 03, 2011, 01:08 PM
<JG>
quote:
If you do a by it sorts from 1 to 9 and a to Z


for those of you that want to know

an ascii sort when using the US standard code page is normally

space, some special characters, 0 - 9, some special characters, A - Z, some special characters, a - z, the other special characters.

It is based on the decimal value of the character.

You do have the ability in WebFOCUS to tell it what the collating sequence should be.

This is the standard list.

32
33 !
34 "
35 #
36 $
37 %
38 &
39 '
40 (
41 )
42 *
43 +
44 ,
45 -
46 .
47 /
48 0
49 1
50 2
51 3
52 4
53 5
54 6
55 7
56 8
57 9
58 :
59 ;
60 <
61 =
62 >
63 ?
64 @
65 A
66 B
67 C
68 D
69 E
70 F
71 G
72 H
73 I
74 J
75 K
76 L
77 M
78 N
79 O
80 P
81 Q
82 R
83 S
84 T
85 U
86 V
87 W
88 X
89 Y
90 Z
91 [
92 \
93 ]
94 ^
95 _
96 `
97 a
98 b
99 c
100 d
101 e
102 f
103 g
104 h
105 i
106 j
107 k
108 l
109 m
110 n
111 o
112 p
113 q
114 r
115 s
116 t
117 u
118 v
119 w
120 x
121 y
122 z
123 {
124 |
125 }
126 ~
128 €
129
130 ‚
131 ƒ
132 „
133 …
134 †
135 ‡
136 ˆ
137 ‰
138 Š
139 ‹
140 Œ
141
142 Ž
143
143
144
145 ‘
146 ’
147 “
148 ”
149 •
150 –
151 —
152 ˜
153 ™
154 š
155 ›
156 œ
157
158 ž
159 Ÿ
160
161 ¡
162 ¢
163 £
164 ¤
165 ¥
166 ¦
167 §
168 ¨
169 ©
170 ª
171 «
172 ¬
173 ­
174 ®
175 ¯
176 °
177 ±
178 ²
179 ³
180 ´
181 µ
182 ¶
183 ·
184 ¸
185 ¹
186 º
187 »
188 ¼
189 ½
190 ¾
191 ¿
192 À
193 Á
194 Â
195 Ã
196 Ä
197 Å
198 Æ
199 Ç
200 È
201 É
202 Ê
203 Ë
204 Ì
205 Í
206 Î
207 Ï
208 Ð
209 Ñ
210 Ò
211 Ó
212 Ô
213 Õ
214 Ö
215 ×
216 Ø
217 Ù
218 Ú
219 Û
220 Ü
221 Ý
222 Þ
223 ß
224 à
225 á
226 â
227 ã
228 ä
229 å
230 æ
231 ç
232 è
233 é
234 ê
235 ë
236 ì
237 í
238 î
239 ï
240 ð
241 ñ
242 ò
243 ó
244 ô
245 õ
246 ö
247 ÷
248 ø
249 ù
250 ú
251 û
252 ü
253 ý
254 þ

Other ASCII code pages change it and EBCIDIC does it different (again code page dependant)
April 07, 2011, 11:26 PM
Arpita
Hi All,
Thanks a lot for your replies and suggestion.
It is a learning experience with you all.

Thanks
Arpita


WebFOCUS 7.6
Windows, All Outputs