Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Side by side comparison (strings & local data)
Message
From
29/12/2003 14:44:48
Walter Meester
HoogkarspelNetherlands
 
 
To
29/12/2003 10:19:38
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
General information
Forum:
Visual FoxPro
Category:
Visual FoxPro and .NET
Miscellaneous
Thread ID:
00861648
Message ID:
00862595
Views:
54
Hi Cetin,

O.K. now it is clear to me. Thanks for pointing that out. I've looked at your code and in my testing it was a little faster than the textmerge approach. However, you did come up with an interesting mechnism to use a fairly unused and unknow VFP feature of SET FIELDS in combination of functions in columns. The only thing that was puzzling me was the inefficient way you added the tags. I did come with the following to circumvent that one.
LOCAL cChar, cFields, cFile, nReccount, nStartTime, ix 

SELECT * FROM h:\ids5\dbfs\t_tanklayout INTO CURSOR _tmpXML NOFILTER READWRITE

nReccount = RECCOUNT()
cFile = SYS(2015)+'.tmp'
nStartTime=SECONDS()
cChar=CHR(13)

cFields = "fb=IIF(RECNO() = 1,'<TEST>'+CHR(13),'')+CHR(9)+'<CLIENT>',"
FOR ix=1 TO  FCOUNT()
	IF !TYPE(FIELD(ix))$'GM'
		cFields = cFields + "f"+ALLTRIM(STR(ix))+"=CHR(9)+CHR(9)+'<"+FIELD(ix)+">'+"
		cFields = cFields + IIF(TYPE(FIELD(ix))$'CM', FIELD(ix), "Transform("+FIELD(ix)+")")+"+"
		cFields = cFields + "'</"+FIELD(ix)+">',"
	ENDIF
ENDFOR
cFields = cFields + "F"+ALLTRIM(STR(ix))+"=chr(9)+'</CLIENT>'+IIF(RECNO() = nReccount,CHR(13)+'</TEST>','')"

SET FIELDS GLOBAL
SET FIELDS TO &cFields
COPY TO (cFile) TYPE DELIMITED WITH "" WITH CHARACTER &cChar
SET FIELDS TO

? SECONDS() - nStartTime

MODIFY FILE (cFile)
ERASE (cFile)
RETURN
I don't think it can be written much faster than this. Even the CURSORTOXML() function is not significantly faster than this.

In the light of this discussion I think we can conclude that because of VFPs data engine you've got multiple tools to skin the cat. Exactly these kinds of mechanisms make VFP such a powerful language. There always seems to be another faster way of munging data. Again with .NET you've got not much other alternatives than iterating trough object collections... OUCH...

Walter,
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform