| The fastest way to get data into a Datawindow is to use
the ImportString command. This flexible command will all you to import
rows of data using a tab delimited string. The ImportString command will
also allow you to import columns of data and multiple lines of data into
a single column.
Enough of the praise and to get to the point! Although the
ImportString command is faster than using an InsertRow and SetItem
commands there is still an overhead to using the command when you are
importing lots of data. Therefore is you are bulk importing lots of data
in a loop it is quicker to build up a very long string of data and call
the ImportString at regular intervals than to Import each row as it is
built up. I have found that around 50k for the the size of the string
give the optimum between string processing overhead and ImportString
command overhead.
If you know your strings will always be less than 50k then you can do
away with the length check in the loop and just Import at the end. A
code example is shown below:
Example1:(no string limiter)
String ls_Import
DO WHILE
...
...
ls_Import += as_Parent + String( al_Seq ) + '~t' + ls_OScript '~r~n'
...
LOOP
lds_Script.ImportString( ls_Import )
Example2:(string limiter)
String ls_Import
DO WHILE
...
...
ls_Import += as_Parent + String( al_Seq ) + '~t' + ls_OScript '~r~n'
IF Len( ls_Import ) > 50000 THEN
lds_Script.ImportString( ls_Import )
ls_Import = ''
END IF
...
LOOP
IF Len( ls_Import ) > 0 THEN
lds_Script.ImportString( ls_Import )
|