Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to get a different order than default on numeric
Message
De
20/12/2003 15:50:12
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00860843
Message ID:
00861035
Vues:
16
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
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform