Date:  10/11/2004 11:36:53 PM Msg ID:  002248
From:  FoxWeb Support Thread:  002245
Subject:  Re: SET TEXTMERGE
If you used your original code and simply changed the delimiters, then your script will not work, because the relevant VFP code is outside the FWX script delimiters.  This will simply cause FoxWeb to treat your code as HTML text.
 
I recommend that you use one of the two functions that I mentioned in my previous message.  Again, if you don't have VFP 7 or above, you can use FoxWeb's MergeTxt function:
 
<%
USE letters IN 0
LOCATE FOR LID = LETTERID
M.LNOTES = LNOTES
 
USE CLIENTS in 0
LOCATE FOR CLID = CLIENTID
MergedText = MergeTxt(M.LNOTES)
%>

FoxWeb Support Team
support@foxweb.com email

Sent by Joe Goldsmith on 10/11/2004 08:06:34 PM:
Thanks for your support. I tried the below with "<<" and "<<" and what happens is that only the first line gets merged such as:
 
LINE 1:  <<MDY(DATE())>><BR><BR>
LINE 2:  <<FIRST>> <<LAST>><BR>
LINE 3:  <<ADDR>><BR>
LINE 4: <<CITY>>, <<STATE>> <<ZIP5>>
 
In the above example, line 1 is changed to the correct date format but lines 2-4 are ignored. It acts like it it not fully merging all the way through the memo file's text. I tried changing the second mergetext parameter to .T. but that did not work either. Any ideas?
 
Joe
Sent by FoxWeb Support on 10/11/2004 02:26:04 PM:
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