Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Regular expressions in VFP
Message
De
09/10/2008 14:56:31
 
 
À
09/10/2008 14:37:25
Information générale
Forum:
Visual FoxPro
Catégorie:
COM/DCOM et OLE Automation
Versions des environnements
Visual FoxPro:
VFP 9
OS:
Vista
Network:
Windows XP
Database:
Visual FoxPro
Divers
Thread ID:
01353849
Message ID:
01353900
Vues:
36
Like I wrote, dump the text to a textfile, and import it into a cursor, one record per line. Create a function to check for valid dates, something like
Function okdata
Lparameters lcText
If !Inlist(Getwordnum(lcText,1,' ,'),'January','February','March','April','May','June','July','August','September','October','November','December')
   Return .f.
Endif       
Return Between(Val(Getwordnum(lcText,2,' ,')),1,31) And Val(Getwordnum(lcText,3,' ,'))>1950
locate for okdate(yourfield)
skip
?'Name = ' + yourfield
skip
?'Adress1 = ' + yourfield
>oDoc = oWord.oDocuments.Open(....)
>cContent = oDoc.Content()
>
>gives me the text
>
>there could be some stuff prior to the date and address
>but somewhere there is a date and then the name/address like:
>
>....
>October 9,2008
>
>Mr Tore Bleken
>123 Fjord Bld.
>Stokke, CT 06279
>
>
>
>dear....
>
>
>......
>.....
>.....
>
>and so on
>
>cContent gets placed into a memo field
>once I get the name I can redo it into lastname, fisrtname
>
>locate it in the contacts table, get the id and update the cletters table with the contact_id
>
>and so on
>
>the tricj is finding the name/address in the content
>if i COULD at least find the date with a regex I could do the rest fairly easyly
>Peter
>
>>If I understand correctly, you have these lines after each other in the letter:
>>Date
>>Name
>>Address1
>>Address2
>>Address3
>>
>>If the date format is fixed, you can convert the letters, one by one, to a text file. Create a cursor with structure c(255), and append from the text file. Scan the cursor, and find the record which contains a legal date. The next record is the name you are looking for.
>>
>>
>>>July 12, 2007
>>>
>>>if i can find this I would be all set, because the name and address comes after it
>>>
>>>Peter
>>>
>>>>Hi,
>>>>
>>>>Not neccessarily impossible - though likely not to be easy.
>>>>
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform