Hi everybody,
I am unable to import the Test.Txt file into the Test.Dbf
I would prefer to have this as a menu option rather than an external program.
Using xdot, i get 4 empty records appended.
Any help would be appreciated.
Thanks,
Rick
Database import
Database import
- Attachments
-
- Test.zip
- (1.29 KiB) Downloaded 942 times
Re: Database import
Hi,
The separator between the fields " ~ " is the problem.
This is not a delimiter.
Kurt
The separator between the fields " ~ " is the problem.
This is not a delimiter.
Kurt
Re: Database import
Hi Kurt,
I tried the parameter DELIMITED WITH to no avail.
When using xdot, the fields map properly as long as the delimiter is changed from the defaulted comma to the tilde.
Rick
I tried the parameter DELIMITED WITH to no avail.
When using xdot, the fields map properly as long as the delimiter is changed from the defaulted comma to the tilde.
Rick
Re: Database import
Rick -
I'll give it a look and get back to you.
Meanwhile, take a look at \exp19\samples\csv\csvimp.prg.
There is a new one attached. I made some changes recently for Aidan Harland.
I use this utility for importing to a DBF from a CSV file.
It allows for mapping of fields.
BTW - I will be in Glen Ellyn Tuesday thru Friday this week. Flying back home on Saturday.
It would be great if we can find time to get together for dinner one night.
Roger
I'll give it a look and get back to you.
Meanwhile, take a look at \exp19\samples\csv\csvimp.prg.
There is a new one attached. I made some changes recently for Aidan Harland.
I use this utility for importing to a DBF from a CSV file.
It allows for mapping of fields.
BTW - I will be in Glen Ellyn Tuesday thru Friday this week. Flying back home on Saturday.
It would be great if we can find time to get together for dinner one night.
Roger
- Attachments
-
- csvimp.zip
- (6.12 KiB) Downloaded 930 times
The eXpress train is coming - and it has more cars.
Re: Database import
Here's program that will do the import:
Code: Select all
#INCLUDE "dcdialog.CH"
FUNCTION Main()
Import( 'Test', 'Test.Txt', '~' )
RETURN nil
* --------------
FUNCTION Import( cDbf, cText, cDelim )
LOCAL nHandle, cLine, aFields, aStru
USE (cDbf)
aStru := (cDbf)->(dbStruct())
nHandle := DC_TxtOpen(cText)
DO WHILE !DC_TxtEof(nHandle)
cLine := DC_TxtLine( nHandle )
aFields := DC_TokenArray(cLine,cDelim)
FormatFields(aFields,aStru)
IF (cDbf)->(DC_AddRec(5))
(cDbf)->(Gather(aFields))
(cDbf)->(dbRUnlock())
ENDIF
DC_TxtSkip(nHandle,1)
ENDDO
(cDbf)->(dbCloseArea())
DC_TxtClose(nHandle)
RETURN nil
* ---------
PROC appsys ; return
* ---------
FUNCTION FormatFields( aFields, aStru )
LOCAL i, cType
FOR i := 1 TO Len(aStru)
cType := aStru[i,2]
IF cType = 'D'
aFields[i] := CtoD(aFields[i])
ELSEIF cType = 'L'
aFields[i] := Upper(aFields[i])[1] $ 'YT'
ELSEIF cType = 'N'
aFields[i] := Val(aFields[i])
ENDIF
NEXT
RETURN nil
The eXpress train is coming - and it has more cars.
Re: Database import
Thanks Roger,
Next week sounds great, let me know when is best for you, Ruths Chris, Harry Caray's, 94th Aero Squadron and Maggianos are nearby should you have a hankering for some red meat in your diet....
Next week sounds great, let me know when is best for you, Ruths Chris, Harry Caray's, 94th Aero Squadron and Maggianos are nearby should you have a hankering for some red meat in your diet....
Re: Database import
Not NEXT week, THIS week! Leaving tomorrow!!!
The eXpress train is coming - and it has more cars.
Re: Database import
OK, gee you must be HUNGRY.....
Have a meeting tomorrow evening will leave the remainder of the week for when you are available.
See you soon.
Have a meeting tomorrow evening will leave the remainder of the week for when you are available.
See you soon.
Re: Database import
Spending the week with lawyers. Gonna learn a lot about depositions.
I'll call you after I find out what the lawyers have in mind first.
I'll call you after I find out what the lawyers have in mind first.
The eXpress train is coming - and it has more cars.