Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Nice order to create
Message
De
18/03/2016 11:08:05
Lutz Scheffler
Lutz Scheffler Software Ingenieurbüro
Dresden, Allemagne
 
 
À
18/03/2016 10:53:53
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:
01633362
Vues:
50
Yess, alltrims are gone now. (_ _)

It runs pretty well, even with stuff like "A..B" or "A. .B"

This was a lot of fun.
Lutz
>"Nice" (and you may go away with the other ALLTRIMs, too).
>
>I still owe you a postcard!
>
>>thats the result I've come up with
>>
>>Thanks for your input
>>
>>
>>TEXT TO lcx NOSHOW
>>CDX
>>1
>>10
>>2
>>03
>>1.1
>>12.R
>>1.1.R
>>1201.1.RBX.250.R.1
>>1201.1.R.250.R.1
>>1201.1.RBX.1.R.1
>>1.R
>>1.R.1
>>A
>>B
>>AA
>>5.R
>>CDXB
>>CDX.R
>>ENDTEXT &&lcx
>>
>>STRTOFILE(lcx,'xyz.tmp')
>>
>>CREATE CURSOR curXYZ (cField c(40),cTag c(40))
>>APPEND BLANK &&just to add an empty record
>>APPEND FROM xyz.tmp DELIMITED WITH TAB
>>
>>DELETE FILE xyz.tmp
>>
>>*get max section length
>>lnLen = 1
>>SELECT;
>> MAX(GetSectLen(Cur1.cField,@lnLen)) AS nLen;
>> FROM curXYZ AS Cur1;
>> INTO CURSOR curLen
>>USE
>>lnLen = lnLen+2 
>>
>>SELECT curXYZ
>>REPLACE ALL cTag WITH IP_ASCII(cField,lnLen)
>>
>>*create index
>>TEXT TO lcx NOSHOW TEXTMERGE  
>>INDEX ON IP_ASCII(cField,<<lnLen>>) TAG anIndex 
>>ENDTEXT &&lcx 
>>EXECSCRIPT(lcx)
>>
>>*there we are
>>BROWSE LAST NOWAIT
>>
>>FUNCTION IP_ASCII
>> LPARAMETERS;
>>  tcField,;
>>  tnLength
>>
>> LOCAL;
>>  lcReturn,;
>>  lcSection,;
>>  lnSections,;
>>  lnSection
>>
>> LOCAL ARRAY;
>>  laCols[1]
>>
>> lnSections = ALINES(laCols, UPPER(m.tcField),5,".")
>> lcReturn   = ""
>> FOR lnSection = 1 TO m.lnSections
>>  lcSection = laCols(m.lnSection)
>>  lcReturn  = m.lcReturn + IIF(ISDIGIT(m.lcSection),PADL(ALLTRIM(m.lcSection),m.tnLength,'0'),PADL(ALLTRIM(m.lcSection),m.tnLength,'@'))
>> NEXT
>>
>> RETURN PADR(m.lcReturn,MIN(LEN(m.tcField),240))
>>ENDFUNC &&IP_ASCII
>>
>>*determine max section length in SELECT SQL
>>FUNCTION GetSectLen
>> LPARAMETERS;
>>  tcField,;
>>  tnReturn
>>
>> LOCAL;
>>  lnSections,;
>>  lnSection
>>
>> LOCAL ARRAY;
>>  laCols[1]
>>
>> lnSections = ALINES(laCols, UPPER(m.tcField),5,".")
>> FOR lnSection = 1 TO m.lnSections
>>  tnReturn = MAX(m.tnReturn,LEN(laCols(m.lnSection)))
>> ENDFOR &&lnSection
>>
>> RETURN tnReturn
>>ENDFUNC &&GetSectLen
>>
Words are given to man to enable him to conceal his true feelings.
Charles Maurice de Talleyrand-Périgord

Weeks of programming can save you hours of planning.

Off

There is no place like [::1]
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform