Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Parsing a file that's not quite comma-delimited
Message
De
11/07/2007 12:34:15
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
 
 
À
11/07/2007 12:15:14
Jay Johengen
Altamahaw-Ossipee, Caroline du Nord, États-Unis
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 8 SP1
Divers
Thread ID:
01238841
Message ID:
01239361
Vues:
17
This message has been marked as a message which has helped to the initial question of the thread.
>>>>If you create specialized LineToObject methods that match with field namings of target tables then you'd directly do an insert into in those methods. The one I wrote is a generic parser.
>>>
>>>Sweet! What is the best way to insert into a cursor from an object?
>>
>>Insert into myTable from name loObjName
>>
>>Cetin
>
>How come the TableName is at the end of the created object, though the ADDPROPERTY for it is prior to the other elements in the code?

Its placement is not important. It's a property and VFP lists them alphabetically. Key point is if you have an object like:
oObj.Dummy = 1
oObj.cust_id = "NEWID"
oObj.Company = "New Company"
oObj.TableName = "Customer"

insert into Customer from name oObj
would insert a new record where only there is a matching between fieldname and property name (here it would create new customer record with cust_id and comapny field only - identical to:
insert into customer (cust_id,company) values ("NEWID","New Company")
That's what makes it great for your case, you need to know your fieldnames and use them instead (remember I directly used field001,field002 etc).

Another cool thing about it is that you can make data conversions there. For example you had data like "20071203102000" which is datetime as it looks.
oObj.PatientIn = "20071203102000"

*and you could directly convert it there:

oObj.PatientIn = CTOT(TRANSFORM(oObj.PatientIn,"@R ^9999/99/99 99:99:99"))
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform