fbpx
Welcome, Guest
Username: Password: Remember me
  • Page:
  • 1

TOPIC: AppendDelimited

AppendDelimited 1 month 1 day ago #9958

  boonnam's Avatar Topic Author boonnam Offline Posts: 37
I see there was a question regarding AppendDelimited under XSharp over a year ago. The thread is www.xsharp.info/forum/public-product/519...appenddelimited#3554 .

I got my code to compile, but my dbf is empty. Here is my code:
METHOD CreateTempTable2(cImportFile)
	LOCAL aNew			AS ARRAY
	LOCAL oNetTemp 		AS DBServer

	aNew := {}
	
	IF !File(SELF:cTempTable)
		AAdd( aNew, { "MPOLICY", "C", 12, 0, "MPOLICY" } )
		AAdd( aNew, { "MCLAIM", "C", 15, 0, "MCLAIM" } )
		AAdd( aNew, { "MSVCPHASE", "C", 5, 0, "MSVCPHASE" } )
		AAdd( aNew, { "MTYPE", "C", 5, 0, "MTYPE" } )
		AAdd( aNew, { "MDATE", "C", 15, 0, "MDATE" } )
		AAdd( aNew, { "MTIME", "C", 3, 0, "MTIME" } )
		AAdd( aNew, { "MUSERID", "C", 25, 0, "MUSERID" } )
		AAdd( aNew, { "MMEMO", "C", 100, 0, "MMEMO" } )
		AAdd( aNew, { "MAPPLIED", "C", 1, 0, "MAPPLIED" } )

        if !DBCREATE(self:cTempTable, aNew, "DBFNTX")
            MessageBox:Show("Unable to create temporary table for import", "Error", MessageBoxButtons:OK)
            return false
        endif
	ENDIF
	
	oNetTemp := DBServer{SELF:cTempTable}
	oNetTemp:Zap()

	oNetTemp:AppendDelimited(cImportFile, "',")	

	oNetTemp:Close()
	oNetTemp := NULL_OBJECT
				
	RETURN TRUE

This code run and create the dbf, but the appenddelimited method isn't putting any data in the table. My reference has System, VORDDClasses, VOSystemClasses, XSharp.Core, XSharp.RT. I am using the latest release (Bandol RC3). Is AppendDelimited still not implemented for XSharp?

Thanks,

Boonnam

Please Log in or Create an account to join the conversation.

Last edit: by boonnam.

AppendDelimited 1 month 1 day ago #9959

  Jamal's Avatar Jamal Offline Posts: 130
I don't have RC3, but AFAIK, the delimiter should be one character. You have two characters ', in:
oNetTemp:AppendDelimited(cImportFile, "',")

It should be:
oNetTemp:AppendDelimited(cImportFile, ",")
That's most likely the issue.

Jamal

Please Log in or Create an account to join the conversation.

AppendDelimited 1 month 1 day ago #9961

  robert's Avatar robert Offline Posts: 1080
Boonnam,

I am sorry but the Delim and SDF RDD are still missing. I had totally forgotten about these.
I think they were also missing from Vulcan ?

The problem with the Delim RDD is that there are very many delimited file formats available. We can emulate the old Clipper/VO delim RDD but that will most likely not be able to import real CSV or Tab delimited files.
Will put this on the todo list.
So what should the Delim RDD support ?

Robert
XSharp Development Team
The Netherlands
This email address is being protected from spambots. You need JavaScript enabled to view it.

Please Log in or Create an account to join the conversation.

AppendDelimited 4 weeks 2 days ago #9985

  Sherlock's Avatar Sherlock Offline Posts: 11
snip[ So what should the Delim RDD support ? ]

oServer:Appenddelimited( cTestfile | oFSinfile ) //
Comma delimited or fixed length
oServer:Appenddelimited( cTestfile | oFSinfile, "/" ) // backslash
oServer:Appenddelimited( cTestfile | oFSinfile, CR ) //
_CHR(13)

Looking at some of old code COMMA, BACKSLASH, CR.. not sure if TAB

But should let you know what I found common..

Phil
Phil McGuinness

Please Log in or Create an account to join the conversation.

AppendDelimited 4 weeks 2 days ago #9986

  FFF's Avatar FFF Away Posts: 637
Better, make it configurable, as most Importroutines do: "AppendDelim(oFile, iHeaderlines,cFieldsep, cTextmarker, cLineEnd)

Karl
Regards
Karl

Please Log in or Create an account to join the conversation.

AppendDelimited 4 weeks 2 days ago #9987

  Sherlock's Avatar Sherlock Offline Posts: 11
Karl / Robert

Maybe you have Clipper/Vo syntax with is path+FILE or FILESPEC and default COMMA been working that way for 20+ years.. if nothing passed beyond oFiles comma separated work fine with appendDelitmited( File )

Why not as Karl says where a big more programmable use say Syntax ;
AppendDeliim( oFile, Headerline, cFieldSpec, cTextMarker, CLineend )

Obviously there is a backward compattibility and say power users.
I mainly use it Bankfiles that fall into 3 or 4 deiimiter categories.. and older concept works fine.
Design a databases with fixed field lengths and AppendDelimited*( oFile ) to it.
Simple and works.. Imagine if only extra parameters, unknown breaks old code.
Phil McGuinness

Please Log in or Create an account to join the conversation.

  • Page:
  • 1