Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Best way to create delimited file with non-standard deli
Message
 
 
To
13/11/2001 11:28:07
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00580703
Message ID:
00580965
Views:
16
>>
>>No, it inserts additional chars instead. We need Field1|^Field2|^Field3|^Field4

Steve,

What I'm concern is speed. I have no problems of using either of suggested methods, my question is, which is the fastest? Currently I'm working on some other tasks, so I can not just run tests and compare speed for each method, besides, this is not my assignment, I was just trying to help my manager, who wants to do it himself...




>Nadya,
>
>I use low level functions when I create EDI files. This is not exactly how I do it, but I have adapted it for you. Is this what you want?
>
>
>procedure copyDelimited
>lparameters lcAlias, && name of alias
>            lcDelimiter, && delimiter may be longer than 1 character
>	    lcOutFile, && name of output file (old file will be overwritten)
>	    llTrim     && flag: trim each field or not
>
>    local  i, ;
>	   lcOut, ;
>	   fh
>
>    private laFields
>
>    fh = fcreate(lcOutFile)
>
>    if fh > 0
>        select (lcAlias)
>        goto top
>        scan
>            copy to array laFields record recno()
>            for i = 1 to alen(laFields)
>                if i = 1
>                    lcOut = iif(llTrim,alltrim(transform(laFields[i])), ;
>                                  transform(laFields[i]))
>                else
>                    lcOut = lcOut + lcDelimiter + ;
>                          iif(llTrim,alltrim(transform(laFields[i])), ;
>                                transform(laFields[i]))
>                endif
>            next i
>            fputs(fh, lcOut)
>        endscan
>        fclose(fh)
>    else
>        ? "unable to create file"
>    endif
>
>endproc
If it's not broken, fix it until it is.


My Blog
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform