Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
TextMerge()
Message
From
31/03/2019 10:48:28
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
 
To
30/03/2019 05:43:43
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Miscellaneous
Thread ID:
01667676
Message ID:
01667782
Views:
71
IMHO, do not make it complex and simply use TextMerge(). Not only in VFP, in all languages, frameworks I know of, templating has some rules. Don't try to bend rules of VFP textmerge. With textmerge, inside the delimiters you can use any "expression". That expression could be a literal, a variable or a function. In VFP this is not an expression:

str1, str2

Instead use a template like:
TEXT TO mtekst1 noshow		&& samo da napuni tabelu tj memo polje

First line : <#m._str1#>
Second line: <#m._str2#>  and then again <#m._str10#><#m._str9#>  and  <#m._str8#><#m._str7#>  for the end
Third line: <#m._str16#><#m._str15#> 

ENDTEXT
You can also have a UDF, which would get a comma separated list of variable names and return their values, then template would be recursive and look like:
Clear
Local lcTemplate, lcSeparator
m.lcSeparator = Chr(13)+Chr(10)
TEXT to m.lcTemplate
--------------------------
My template result is:
<< myUDF('m.str1, m.str2, m.str3', m.lcSeparator) >>
--------------------------
ENDTEXT
? Textmerge(m.lcTemplate,.T.)

Procedure myUDF(tcParms, tcSeparator)
	Local str1, str2, str3

	m.str1 = "a"
	m.str2 = Datetime()
	m.str3 = 3

	Local ix, lcReturn
	lcReturn=''
	For ix=1 To Alines(laParm,m.tcParms,1+4+8,',')
		m.lcReturn = m.lcReturn + ;
			Iif(Empty(m.lcReturn),'',m.tcSeparator) + ;
			Textmerge("<< Evaluate(laParm[m.ix]) >>")
	Endfor
	Return m.lcReturn
Endproc
PS: I see you are ignoring the "important" m. (dot) prefix.
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Reply
Map
View

Click here to load this message in the networking platform