Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Nice order to create
Message
De
18/03/2016 06:34:04
 
 
À
18/03/2016 06:19:05
Lutz Scheffler
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
Versions des environnements
Visual FoxPro:
VFP 9 SP2
OS:
Windows 8.1
Network:
SAMBA Server
Database:
Visual FoxPro
Application:
Desktop
Divers
Thread ID:
01633318
Message ID:
01633332
Vues:
55
TEXT TO lcx NOSHOW  
1
10
2
03
1.1
12.R
1.1.R
1201.1.RBX.250.R.1
1.R
1.R.1
A
B
AA
5.R
CDXB
ENDTEXT &&lcx 

STRTOFILE(lcx,'xyz.tmp')

CREATE CURSOR curXYZ (cField c(40), cSortFld c(240))
APPEND FROM xyz.tmp DELIMITED WITH TAB
DELETE FILE xyz.tmp

replace ALL cSortFld WITH IP_Ascii (cField)
INDEX on cSortFld TAG cSortFld
browse


FUNCTION IP_ASCII(tcRow)
LOCAL lnColLen, lnMaxCol, lnColCnt, laCols[1], lcErg, lcAdd, luCol
lnColLen = 5
lnMaxCol = 7
lnColCnt = ALINES(laCols, UPPER(tcRow),1,".")
lcErg = ""
FOR lnCurCol = 1 TO lnMaxCol
   lcAdd = IIF(lnColCnt>=lnCurCol,laCols[lnCurCol], "")
    lcErg = m.lcErg + PADL(m.lcAdd, m.lnColLen, iif (EMPTY(m.lcAdd), CHR(45), IIF(ISAlpha(m.lcAdd), CHR(64), CHR(47)))) + "." 
next
RETURN m.lcErg
>I'm in general no friend of definition of such borderes besides field lenght and VFP type and field limitations. There are reasonable assumptions, but we all remember the two digit years or the 1.9.[19]99 as default value ...
>
>Let's say we do 5 digits per group and no mix of numeric / non numeric.
>
>The index is on a CA, I can generate the index code on the fly and do a guess depending on recent field values, so we just can take any number.
>
>What I have a problem with is is to split the field into any other fields, because this needs to be done on any change while the cursor is living - and that's a pain.
>
>Also the CA is refreshed in a not to slow pace, so scanning through it seems not fine.
>
>>Define very large borders, like max # dots less than 30, max 8 of chars between each dot and it is easy to parse into 1 char field and index that ;-))
>>User is even allowed to mix numeric and non-numeric if he accepts 0,1,9,A,B
>>just padl(upper(),"0")each "dotted" column read in via alines(,,"0") and fill empty columns...
>>lokk at bottom example of left filled "ASCII-IP"
>>
>>>We name a record with field x simply a record.
>>>
>>>Any record with a non numeric infront of the first or none dot is trailing any record with numerics in front of first or none dot.
>>>Numerics and non numerices should not be mixed with in a group delimited by dots.
>>>Numerics should be orderd numerical.
>>>Non numerics could be any letter [A..Z]+ and should be ordered like numericals A,B,AA,AB, AAC (there is a small chance to talk customer into alphabetical order, because AA is not very likely)
>>>With in the order given above the following groups should follow this. It's high probalility to have just groups of .1 and .R now, but I don't like to run in it the other day.
>>>
>>>Nun ist es bestimmt klar wie Kloßbrühe ... :(
>>>
>>>>the ordering of "03" needs converting via value, ordering "AA" after "B" might imply converting via Hex or at least a padl(), but then you will give me an item with a letter beyond "F" like "R" in first spot or n- letter groups ? Can you define the ordering algorithm in words?
>>>>
>>>>//upd: if you can define a max length between dots, a max # of dots (arbitrarily high would be enough) and can exclude all chars not in ["0".."9"] or ["A".."Z"]
>>>>you could build an ordering string of padl() columns, see example down below in your ordered data, with comment on "03"
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform