Importing data from tabbed delimited files

Irv Kalb Irv at furrypants.com
Tue Sep 16 15:39:08 CDT 2008


Thanks everyone for the responses.  That fixed it!

I'm sure I'll be back soon with more questions.

Thanks,

Irv

At 10:25 PM -0700 9/15/08, Irv Kalb wrote:
>Hi,
>
>Long time Director developer, just starting to use Valentina.  I'm
>porting a set of old applications from V12 to Valentina.
>
>My client creates a number of text files by building spreadsheets in
>Excel, then exporting them as tabbed delimited files.  I want to run
>through this set of files, and build a table for each file.  I found
>the ImportText command in the Import_Export example and I'm hoping
>that this is the proper way to do this.
>
>I have created a database file and I want to read a simple file
>called "Feedback", which consists of just two text strings in each
>line, like this:
>
>POSITIVE	NEGATIVE
>Excellent	No way
>Good job	Sorry
>Great going	Oops
>Good	Incorrect
>That's right	Try again
>
>The file is called "Feedback.txt" and is in the same directory as the
>application.  Here is the code that I am trying to use:
>
>    oFeedbackTable = gDb.createTable("Feedback")
>    if CheckValError() then exit
>
>    lPos = oFeedbackTable.createStringField("POSITIVE", 40)
>    if CheckValError() then exit
>
>    lNeg = oFeedbackTable.createStringField("NEGATIVE", 40)
>    if CheckValError() then exit
>
>    curs = gDB.SqlSelect( "SELECT * FROM Feedback WHERE FALSE" )
>    curs.ImportText(the moviePath & "Feedback.txt", TAB, 
>numToChar(13), "", TRUE)
>
>Everything seems fine up to the ImportText command.  When that
>executes, I get an error for every line saying that the cursor is
>read only:
>
>
>
>
>
>
>
>   So I go to the documentation and it says:
>
>Note:  The Cursor must have the flag CanBeUpdated set to TRUE.
>
>
>But unfortunately, this flag is not documented anywhere else in the
>manual.  So I tried to add a line that says:
>
>    curs.CanBeUpdated = TRUE
>
>right before the curs.ImportText(...)
>
>But when I do that, I get a property not found dialog box saying that
>it cannot find CanBeUpdated.
>
>Two questions:
>
>1)  Is using the ImportText call the proper way to read in a TAB
>delimited file (produced from Excel)?  If not is there an easy way to
>do this, or do I have to parse all the data and build the table item
>by item?
>
>2)  If ImportText is the proper way to do this, what line do I use to
>set the CanBeUpdated flag to TRUE?
>
>Thanks in advance,
>
>Irv
>
>
>--
>
>Multimedia R Us
>_______________________________________________
>Valentina mailing list
>Valentina at lists.macserve.net
>http://lists.macserve.net/mailman/listinfo/valentina


-- 

Multimedia R Us


More information about the Valentina mailing list