Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Twisting my Melon...
Message
From
02/04/2001 08:33:35
 
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00490651
Message ID:
00490890
Views:
13
Here is a routine I wrote several years ago

It may help:)
******************************************************************************
*
*       Function: MKMEMO
*
*
*     Parameters: fields to be included in memo, the select expression if required ie a=b, the delimiter to be used
*        Returns: Results of the select as a concatanated string
*      Variables:
*               : lcFields        Fields list for select
*               : lcExpr          The limiting select expression
*               : lcDelimiter     The separator to be used (It defaults to a carriage return)
*               : lcCom           Macro string for execution to create browse window
*               : lcMemo          The string variable the select result ends up in
*               : liFcount        The number of fields in the select
******************************************************************************
*[169
* OVERVIEW of SWEPROC.PRG MKMEMO
* Allows placing of mutiple different size columns on reports by storing the columns in concatenated string
*]169

FUNC mkmemo
LPARAM lcFields,lcExpr,lcDelimiter
* lcFields = fields to be included in memo ie "Name,Address,Zip"
* lcExpr = the select expression if required ie "Name=Cusname"
* lcDelimiter = the record delimiter to be used it defaults to a cariage Return line feed
lcAlias=ALIAS()
lcFields=IIF(TYPE('lcFields')='C' AND !EMPTY(lcFields),lcFields,'*')
lcExpr=IIF(TYPE('lcExpr')='C' AND !EMPTY(lcExpr),lcExpr+' and !deleted() ','!deleted()')
lcDelimiter=IIF(TYPE('lcDelimiter')='C' AND LEN(lcDelimiter)>0,lcDelimiter,CHR(13)+CHR(10))
lcCom = [SELECT ]+lcFields+[ FROM ]+lcAlias+[ WHERE ]+lcExpr+[ INTO CURSOR ZQUERY]
&lcCom
lcMemo=''

IF RECCO()>0
	liFcount=FCOUNT()
	SCAN
		FOR i = 1 TO liFcount
			lcMemo=lcMemo+' '+ALLTRIM(trans(EVAL(FIELD(i))))
		ENDFOR
		lcMemo=lcMemo+lcDelimiter
	ENDSCAN
ENDIF
if used('zquery')
   use in zquery
endif
SELE (lcAlias)
RETURN lcMemo
>Any ideas on how to tackle this one? It's twisting my melon real bad...!
>
>I need to copy to a text file the contents of three tables. The first table contains the first line of the text file - a header. The second table contains multiple lines of information that needs to appear one following the next and the third table contains a footer line.
>
>I have been experimenting with COPY TO WITH DELIMITED BLANK but it is not working on several fronts...
>
>1. I SELECT each table in turn and COPY TO but it overwrites the file each time and I end up with only the footer...
>2. Theresulting text file contains spaces between the fields and character fields have quotes - both of which I need to remove.
>
>I guess what I need to do is either get the data in better shape before writing to the text file or alternatively, find a way of manipulating the text file...
>
>Thanks in advance...
Previous
Reply
Map
View

Click here to load this message in the networking platform