Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to get a different order than default on numeric
Message
From
20/12/2003 15:50:12
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00860843
Message ID:
00861035
Views:
17
This message has been marked as the solution to the initial question of the thread.
Hi Kirk,

with string use this :
CREATE CURSOR ctab (LayoutValue N(10,4))
SET TALK OFF
CLEAR

INSERT INTO ctab VALUES(4.1000)
INSERT INTO ctab VALUES(4.1100)
INSERT INTO ctab VALUES(4.1200)
INSERT INTO ctab VALUES(4.1110)
INSERT INTO ctab VALUES(4.2000)
INSERT INTO ctab VALUES(4.2100)
INSERT INTO ctab VALUES(5.0000)
INSERT INTO ctab VALUES(5.1111)
INSERT INTO ctab VALUES(5.2110)
	 
INDEX ON BINTOC(LayoutValue);
	+	CHR(LayoutValue*10000 	% 10);
	+	CHR(LayoutValue*1000 	% 10);
	+	CHR(LayoutValue*100	% 10);
	+	CHR(LayoutValue*10  	% 10) TAG LayOut1

BROWSE

SELECT *;
,	BINTOC(LayoutValue)				;
+	CHR(LayoutValue*10000 	% 10)	;
+	CHR(LayoutValue*1000 	% 10)	;
+	CHR(LayoutValue*100 	% 10)	;
+	CHR(LayoutValue*10  	% 10)	expSort;
	FROM ALIAS() ORDER BY  expSort
With pure math trasformation ( but VFP can insert rounding errors ):
INDEX ON	INT(LayoutValue			)*10000	;
+		INT(LayoutValue*10000	%10	)*1000	;
+		INT(LayoutValue*1000	%10	)*100	;
+		INT(LayoutValue*100	%10	)*10	;
+		INT(LayoutValue*10	%10	)		;
TAG LayOut1
Fabio
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform