Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
CSV String to Cursor?
Message
From
20/10/2000 03:19:21
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00431527
Message ID:
00431979
Views:
9
>>>Dan;
>>>
>>>I think that would only work with files, Dan. I'm trying to import from a string without saving it to a file. I've worked out a routine, but I thought maybe it could be shorter, faster and simpler.
>>>
>>>Of course, writing each string to a file and then importing would be short and sweet, but probably needlessly slow...
>>>
>>
>>How about using STRTOFILE() to create the file, then using APPEND FROM?
>>
>>Tamar
>
>Yeah - my gut said avoiding disk writes would be faster. Thanks, tho.

David's solution is simpler than this, but you wanted to avoid disk access...
lparameter tcSting

create cursor cursorname (col1 c(20), col2 i)

lnRowCount = alines(laRows, tcString)    && limit of 65000 rows

for each lcRow in laRows
    lnColCount = alines(laCols, strtran(lcRow, ",", chr(13))
    insert into cursorname (col1, col2) values (laCols[1], val(laCols[2]))
endfor
Previous
Reply
Map
View

Click here to load this message in the networking platform