Subject Re: Tab Delimited
From Mervyn Bick <invalid@invalid.invalid>
Date Thu, 03 Apr 2014 10:42:58 +0200
Newsgroups dbase.getting-started

On Thu, 03 Apr 2014 10:08:08 +0200, Mervyn Bick <invalid@invalid.invalid>  
wrote:

> On Thu, 03 Apr 2014 08:51:53 +0200, Rob Rickard <rob@nospam.com.au>  
> wrote:
>
>> Thanks Mervyn
>> Sorry you could not sleep worry about the code :)
>> Why only 2 cups? My wife thinks coffee is in my veins with the amount  
>> she thinks I drink.
>> Once again thank you.
>
> I didn't really lose any sleep.  I woke up, realised I'd made a mistake  
> in the code and went straight back to sleep. <g>
>
> My wife KNOWS how much coffee I drink because she makes it. <g>

Oops. Finger trouble, wrong button so the message got sent although I  
hadn't finished what I wanted to say.

The date field is empty at the moment so it doesn't need special  
handling.  If the field ever has a value in the text file you will need to  
do something about it as dBASE will not accept a test value into a date  
field.  At it's most simple, if the date is in the same format as set for  
your computer, then ctod() will do the trick.  If the date format in the  
test file doesn't match then you will need to convert it appropriately.

You could, of course, simply use a character field in your .dbf file but  
then you will have resort to a bit of fancy footwork if you wanted, say,  
to examine records in a 30day period.


   for n = 1 to q.rowset.fields.size -1
       if n = x  //x = actual number of date field
          cDate =  substr(cRead,at(chr(9),cRead,n)+1;
                    ,at(chr(9),cRead,n+1)-at(chr(9),cRead,n)-1)
          q.rowset.fields[n].value = ctod(cDate)
       else
         q.rowset.fields[n].value = substr(cRead,at(chr(9),cRead,n)+1;
           ,at(chr(9),cRead,n+1)-at(chr(9),cRead,n)-1)
       endif
   next

Mervyn.