Page 2 of 2

Posted: Tue Dec 21, 2004 1:55 pm
by dsrules
Well, I had a externally pathed hash file. I created a VOC and used the in account selected when reading the hash file. In the selection tab I used @ID BY @ID, I got sorted hash file on the key.

Posted: Mon Feb 21, 2005 2:11 pm
by olgc
Hi there,

When I have a chance to reexamine the result, it seems sorted orderly, but in a different way. The key's type is SQL Integer, but it is sorted as string. The result is as the following. How can hashed file be sorted as Integer (coresponding to its key data type, not as string)?

Result:

1
10
100
10000
10001
...
10009
1001
10010
..
10019
1002
10020
..

The order I want is:

1
10
100
1001
1002
10000
10001
...

Thanks,

Posted: Mon Feb 21, 2005 2:16 pm
by kduke
I would use a UV stage and a SQL SELECT. You can either fix the dictionary item or add one or use an EVAL.

Code: Select all

SELECT * FROM MyHashFile ORDER BY EVAL '"@ID" FMT '3R';

Posted: Mon Feb 21, 2005 3:13 pm
by ray.wurlod
You can do this with a Hashed File stage. The sort phrase is augmented with the FMT field qualifier. You don't need EVAL if using a Hashed File stage.

Code: Select all

BY @ID FMT "10R"

Posted: Mon Feb 21, 2005 3:54 pm
by olgc
I try Ray's method, and it works very well.

Thanks all your guys!