| Nice, I really like the use of @include to read a file in with the file action, never thought of that.
Only thing, witango is awesome, but its weakness is looping through a bunch stuff, and manipulating data. This would bring witango to its knees on a large file. I would guess, on a few hundred kilobytes, a compiled function, external action, would be somewhere in the 1000 x faster range. And the large the data size, the order of magnitude increases. So performance benefit with compiled function, or optimized perl script or something, will be maybe 10000 x faster with a meg and so on.
In some situations, you may not mind that witango is loaded down on a function like this, but in an env where witango is supposed to be handling user requests, it would not be the best thing.
You could write a perl script, and call it externally, or write a java bean, or a compiled VB command line app, or find a com object. Its just my two cents, but I think it is REAL important when you are managing resources for consumption.
--�
Robert Garcia President - BigHead Technology VP Application Development - eventpix.com 13653 West Park Dr Magalia, Ca 95954 ph: 530.645.4040 x222 fax: 530.645.4040 On Jun 8, 2005, at 3:18 PM, Wayne Irvine wrote: Fogelson, Steve at [EMAIL PROTECTED] wrote: I am reading an Excel CSV file into an array with a Read Action. You could try something like this. It parses the file and works out whether a comma is between quotes or not. <@ASSIGN NAME=FileContents VALUE='<@INCLUDE FILE="<@APPFILEPATH>updatefiles:<@VAR local$DistinctFileListArray[<@VAR local$currfile>,1]>">' SCOPE=LOCAL> <@IFEMPTY VALUE='@@local$FileContents'> File is Empty <@ELSE> <@ASSIGN NAME=DoubleQuote VALUE='OFF' SCOPE=LOCAL> <@ASSIGN FileContents VALUE=<@REPLACE STR=<@VAR local$FileContents> FINDSTR=<@CRLF> REPLACESTR="[ROW]"> SCOPE=LOCAL> <@ASSIGN FileContents VALUE=<@REPLACE STR=<@VAR local$FileContents> FINDSTR=<@CHAR CODE=10> REPLACESTR="[ROW]"> SCOPE=LOCAL> <@ASSIGN FileContents VALUE=<@REPLACE STR=<@VAR local$FileContents> FINDSTR=<@CHAR CODE=13> REPLACESTR="[ROW]"> SCOPE=LOCAL> <@ASSIGN FileContents VALUE=<@REPLACE STR=<@VAR local$FileContents> FINDSTR=<@CHAR CODE=63> REPLACESTR=""> SCOPE=LOCAL> <@FOR START=1 STOP=<@LENGTH <@VAR local$FileContents>>> <@ASSIGN NAME=CurrChar Value=<@SUBSTRING STR=<@VAR local$FileContents> START=<@CURROW> NUMCHARS=1> SCOPE=LOCAL> <@ASSIGN NAME=NextChar Value=<@SUBSTRING STR=<@VAR local$FileContents> START=<@CALC EXPR='<@CURROW> + 1'> NUMCHARS=1> SCOPE=LOCAL> <@IF EXPR='<@VAR local$CurrChar>=<@DQ>'> ����<@IF '(<@VAR local$DoubleQuote>="ON") AND (<@VAR local$NextChar> = <@CHAR CODE=44>)'> �������<@ASSIGN NAME=DoubleQuote VALUE='OFF' SCOPE=LOCAL> ���<@ELSEIF '<@VAR local$DoubleQuote>="OFF"'> �������<@ASSIGN NAME=DoubleQuote VALUE='ON' SCOPE=LOCAL> ��� ����</@IF> <@ELSEIF EXPR='<@VAR local$CurrChar>=<@CHAR CODE=44>'> ����<@IF '<@VAR local$DoubleQuote>=OFF'> �������<@ASSIGN NAME=NewString VALUE="<@VAR local$NewString>[COL]" SCOPE=LOCAL> ���<@ELSEIF "<@VAR local$DoubleQuote>=ON"> �������<@ASSIGN NAME=NewString VALUE="<@VAR local$NewString><@VAR local$CurrChar>" SCOPE=LOCAL> ���</@IF> <@ELSE> ����<@ASSIGN NAME=NewString VALUE="<@VAR local$NewString><@VAR local$CurrChar>" SCOPE=LOCAL> </@IF> </@FOR> <@ASSIGN NAME=UpdateArray VALUE=<@ARRAY VALUE=<@VAR local$NewString> CDELIM='[COL]' RDELIM='[ROW]'> SCOPE=local> <@VAR local$UpdateArray><br> NUMROWS: <@NUMROWS ARRAY=local$UpdateArray><BR> </@IF> ������������������Byte Services Pty Ltd ���������������http://www.byteserve.com.au/ ������������������[EMAIL PROTECTED] ���Ph 02 9960 6099 ��Mob 0409 960 609 ��Fax 02 9960 6088 ________________________________________________________________________
TO UNSUBSCRIBE: Go to http://www.witango.com/developer/maillist.taf
________________________________________________________________________
TO UNSUBSCRIBE: Go to http://www.witango.com/developer/maillist.taf
|