Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
XLSX and DOCX
Message
General information
Forum:
Visual FoxPro
Category:
COM/DCOM and OLE Automation
Title:
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Vista
Miscellaneous
Thread ID:
01537166
Message ID:
01538629
Views:
62
Hi Kevin,

Have only read and typed without testing, but the change below
should speed up all cases where you have to write out large tables.
In your version the growing lcRow has to be recopied in memory for every field,
which will take more time as lcRow grows. If you add up lcData for each record,
the runtimes should be better in almost all all cases,
esp. where reccount()> fcount() and fcount()>50 ;-)

Also: I am pretty sure that your idea to handle NULL values is not working as planned -
You have code NVL() in cases where you check vartype() ?
Vartype() should give you "X" when encountering NULL-Values,
so nvl() should never be needed in those branches.
Having NULL in a numeric field would move on into loop, which from pure visualization
should mess up the "record line" if it happens when further data needs to be added -
not tested, just visualized though...

probably an array created at one of the 2 field-loops before and filled with the correct
field type for the column is better and faster than TYPE() and gives you also correct control
- you can add Null-specific code either in the branches
of the case either with nvl or explicit vartype() check.

you might give a pingback to Christoph about your additions - but check NUll-behaviour up front,

regards

thomas

>
>
>***************** and here is all the data rows  **************************************************************************************
>Scan
>	lcRows = m.lcRows + "<Row>"
        lcData = ""
>	For lnField = 1 To Fcount()
>		luValue = Evaluate(Field(m.lnField))
>		Do Case
>		Case Inlist(type(Field(m.lnField)),"C","Q","V")
>*!*	       STRCONV(,9) = STRCONV(,9) - 1 the 9 Converts double-byte characters in cExpression to UTF-8
>			lcString = Strconv(Alltrim(m.luValue),9)    && let's remove any illegal characters that will confuse the simple XML -- like "<>"
>			lcString =STRTRAN(lcString,"<","")
>			lcString =STRTRAN(lcString,">","")
			lcData = m.lcData + ;
>				[<Cell ss:StyleID="s23">]+[<Data ss:Type="String">]+lcString+[</Data>]+[</Cell>]
>		Case Inlist(type(Field(m.lnField)),"M")
			lcData = m.lcData + ;
>				[<Cell ss:StyleID="s22">]+[<Data ss:Type="String">]+Strconv(Alltrim(m.luValue),9)+[</Data>]+[</Cell>]
>		Case Inlist(Vartype(m.luValue),"L")
			lcData = m.lcData + ;
>				[<Cell ss:StyleID="s23">]+[<Data ss:Type="String">]+IIF(Transform(m.luValue)==".T.","TRUE","FALSE")+[</Data>]+[</Cell>]
>		Case Inlist(Vartype(m.luValue),"N","B","F","I")
***** as m.luValue can never be NULL due to Vartype() check, NVL() makes no sense and if NULL occurs in this column,
***** LOOP in Otherwise will IMHO make problems as the No. of columns is wrong
*****		Case Inlist(laFieldtypeData[m.lnField],"N","B","F","I") && if created before scan starts...
			lcData = m.lcData + ;
>				[<Cell ss:StyleID="s23">]+[<Data ss:Type="Number">]+Transform(Nvl(m.luValue,0))+[</Data>]+[</Cell>]
>		Case Inlist(Vartype(m.luValue),"Y")
			lcData = m.lcData + ;
>				[<Cell ss:StyleID="s23">]+[<Data ss:Type="String">]+Transform(Nvl(m.luValue,0))+[</Data>]+[</Cell>]
>		Case Inlist(Vartype(m.luValue),"D","T")
			lcData = m.lcData + ;
>				[<Cell ss:StyleID="s23">]+[<Data ss:Type="String">]+Transform(Nvl(m.luValue,""))+[</Data>]+[</Cell>]
>		Otherwise
>			LOOP   && skipping blobs and generals
>		ENDCASE
		****** lcRows = m.lcRows +m.lcData && takes too long if recno>100K!		
>	Endfor
	lcRows = m.lcRows + m.lcData + "</Row>"
>ENDSCAN
>
>***************** /Data Rows  **************************************************************************************
>
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform