Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Collate problem
Message
De
17/02/2009 08:54:37
 
 
À
17/02/2009 08:41:51
Lutz Scheffler (En ligne)
Lutz Scheffler Software Ingenieurbüro
Dresden, Allemagne
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Titre:
Versions des environnements
Visual FoxPro:
VFP 9 SP2
Divers
Thread ID:
01382300
Message ID:
01382326
Vues:
45
ah, Agnes,

And I thought you picked up the files from the file system...

Well - proposal
(1) Check locally if the sorting sequence is ok, by adding a few files in a folder manually

(2) if (1) is ok, then
- create a temp folder
- strToFile('', addbs(tmpFolder) + rtrim(TableName.FieldName) ) all names you have in the table

(3) sort the folder using ("Scripting.FileSystemObject")

(4) update an int in the table (the number of the file out of ("Scripting.FileSystemObject")

(5) get rid of the tmp folder and its contents

(6) set the index to that int field

(7) grid.Refresh()

(8) done

>Gregory,
>
>I do have names in a table only. The files may exist somewhere, but out of my scope.
>
>Agnes
>
>>Agnes,
>>
>>
>>Try this - seems to sort like windows explorer (if this does not work>> then plan C - Regular expressions)
>>
>>
>>
>>	ofs = CreateObject("Scripting.FileSystemObject")
>>	folder = ofs.GetFolder('d:\tmp\')
>>	for each file in folder.Files 
>>		?file.Name
>>	endfor
>>
>>
>>
>>>Hi Gregory,
>>>
>>>it was example only. ::)
>>>
>>>Anyway, it seems not that easy
>>>
>>>it sorts like
>>>0A.txt
>>>1.1.txt
>>>1.txt
>>>1A.txt
>>>9A.txt
>>>10.txt
>>>11A.txt
>>>111.txt
>>>A.txt
>>>
>>>so I can not simple swap the characters. Infact, I can not see a dynamic way like index to do this. It would require a "key column" and a special run to order it. (just like the explorer, it does not sort on the fly.
>>>
>>>
>>>Hm now I run into StrCmpLogicalW but this compares two strings, not sorting an array. Does this realy mean I have to do the sorting myself?
>>>
>>>>hi Agnes,
>>>>
>>>>I would include lower case as well (verify the strings)
>>>>
>>>>
>>>>>INDEX ON chrtran(c1,'ABCDEFGHIJKLMNIOQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789','0123456789ABCDEFGHIJKLMNIO0123456789ABCDEFGHIJKLMNIOQRSTUVWXYZ') TAG _c2
>>>>
>>>>
>>>>>Hi Gregory,
>>>>>
>>>>>that seems to be the start.
>>>>>
>>>>>I think I will simply use something like
>>>>>
>>>>>INDEX ON chrtran(c1,'ABCDEFGHIJKLMNIOQRSTUVWXYZ0123456789','0123456789ABCDEFGHIJKLMNIOQRSTUVWXYZ') TAG _c2
>>>>>
>>>>>
>>>>>> ...re-educate the customer...
>>>>>
>>>>>I have no idea what to teach them here.
>>>>>
>>>>>Agnes
>>>>>
>>>>>>Agnes,
>>>>>>
>>>>>>The sort order of the Windows Explorer is described here http://windowsxp.mvps.org/xpsortorder.htm
>>>>>>
>>>>>>The only way out for you is to have an extra field in your cursor with the filename strtran() in such a way that the digits come after the alphabet
>>>>>>eg map
>>>>>>a, A to hex 01
>>>>>>b, B to hex 02
>>>>>>...
>>>>>>
>>>>>>0 to 0x01 + 0x20 or so
>>>>>>
>>>>>>Then the index has to be Machine
>>>>>>
>>>>>>
>>>>>>Then you have to watch out for the accented chars + eszet
>>>>>>
>>>>>>You can try to re-educate the customer...
Gregory
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform