Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Best way to create delimited file with non-standard deli
Message
From
13/11/2001 11:28:07
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00580703
Message ID:
00580920
Views:
15
This message has been marked as a message which has helped to the initial question of the thread.
>
>No, it inserts additional chars instead. We need Field1|^Field2|^Field3|^Field4

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
Steve Gibson
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform