VFP's TEXTMERGE functionality uses the delimiters set by the SET TEXTMERGE DELIMITERS statement. By default these delimiters are "<<" and ">>". Please note that delimiters can only be up to two characters long, so you could not use "<%=" as a delimiter.
By the way, if you are using VFP 7 or 8, you can use VFP's TEXTMERGE() function:
TEXTMERGE(cExpression [, lRecursive [, cLeftDelim [, cRightDelim]]])
With MergeTxt, the code below could be re-written as follows:
<%
USE letters IN 0
LOCATE FOR LID = LETTERID
M.LNOTES = LNOTES
USE CLIENTS in 0
LOCATE FOR CLID = CLIENTID
MergedText = TEXTMERGE(M.LNOTES, .F.)
%> |
The resulting text would be returned in the MergedText variable.
For older versions of VFP you can use FoxWeb's MergeTxt() function, which has similar functionality. The documentation for MergeTxt can be found in http://www.foxweb.com/document/MergeTxt.htm.
FoxWeb Support Team support@foxweb.com email |
Sent by Joe Goldsmith on 10/09/2004 10:09:58 PM:
I have a memo field with text and field names such as "Hi <%=(clfirst)%>" that I want to do a text merge to create a merged letter. The code looks something like:
<%
USE letters IN 0
LOCATE FOR LID = LETTERID
M.LNOTES = LNOTES
USE CLIENTS in 0
LOCATE FOR CLID = CLIENTID
%>
<%SET TEXTMERGE ON%>
<%SELECT CLIENTS%>
<%=TEXTMERGE(M.LNOTES)%>
<%SET TEXTMERGE OFF%>
No matter how I write it it does not work. Perhaps I need delimiters such as "<<" and ">>" to make it work. Would anyone know what I'm doing wrong or would like to send me a code fragment that works Please?
Joe