Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
CSV with double quotes
Message
De
08/03/2017 03:49:23
 
 
À
08/03/2017 02:45:14
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
01648804
Message ID:
01648848
Vues:
36
>>>More polished than my 1liner for sure ;-) Quick nosy question - did you compare your approach of writing out to file and concatenating header line with that file to _clip to inserting header line and then inserting one row down directly fro .DataToClip(,,3)? On current SSD probably irrelevant, but it perked my "find best way" character deficit ;-)
>>
>>Did that regularly 10-12 years ago, and it was drastically faster. And it's not the amount of data (SSD being irrelevant for the case) but in the sheer amount of COM/DOM addressing when playing automation cell-by-cell or massaging a csv to do exactly what we want and not be misinterpreted. _vfp.datatoclip(,,3) combined with oExcel.Range.Paste() is the fastest I've found so far.
>>
>From Cetins code you had deleted:
>> lcTempFile = Sys(2015)+".txt"
>> Copy Next m.lnMaxRows-1 To (m.lcTempFile) Delimited With Tab
>> _Cliptext = m.lcHeader + Filetostr(m.lcTempFile)
>> Erase (lcTempFile)
>> .Range("A1").PasteSpecial()
>
>Both approaches use the clipboard, only Cetin goes first to disk, then concats, whereas my idea would be to paste twice: first for the single header line, then for the whole table loaded directly with datatoclip(,,3), somthing like
>
>> _Cliptext = m.lcHeader
>> .Range("A1").PasteSpecial()
>> _vfp.datatoclip(,,3)
>> .Range("A3").PasteSpecial()
>
>Therefore I think disk speed might play a role comparing both approaches, even if as here maybe only a part of table will be copied - a vfp cursor often does not need to write if filter is simple enough and filling the clipboard from there could be faster than the explicit copy to, filetostr() dance needed for concat and single paste ;-)

Not sure how disk speed should factor into this... I for one have a UPS and configure disk caching of writes as aggressively as possible. As long as the cache isn't overwhelmed, it should be way faster than any SSD.
Regards. Al

"Violence is the last refuge of the incompetent." -- Isaac Asimov
"Never let your sense of morals prevent you from doing what is right." -- Isaac Asimov

Neither a despot, nor a doormat, be

Every app wants to be a database app when it grows up
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform