TEXTMERGE()

From Lianjapedia
Jump to: navigation, search

Purpose

Function to evaluate a character string, merging any delimited expressions

Syntax

TEXTMERGE(<expC1> [, <expL> [, <expC2> [, <expC3>]]])

See Also

\, \\, SET TEXTMERGE, TEXT

Description

The TEXTMERGE() function evaluates a character string, <expC1>, merging any delimited expressions. Delimited expressions may include table field names, memory variables, and functions. The default text delimiters are << and >>. To use a different set of characters to delimit text, specify the starting delimiter in <expC2> and the end delimiter in <expC3>. The <expL> is used to flag whether to iterate through levels of delimiters.

Example

fd = fcreate("template.txt")
fputs(fd,"Dear <<trim(first_name)>>,")
fputs(fd, "Thank you for your email of <<date()>>.")
fputs(fd, "We will be back in contact shortly.")
fputs(fd, "Best regards,")
fputs(fd, "<<username()>>")
fclose(fd)
 
m_contents = filetostr("template.txt")
open database southwind
use example in 0 current
 
?textmerge(m_contents)