I'm guessing if it is possible to put the content of a variable into a report using the <% %> substituition engine of the revPrintField command. In other words, if I have a field named "myReport" containing:
What I want to do is to fill a print template with values coming from variables. I hoped to avoid to write some code by myself using the <% %> substitution.
on subsInFld @myArray,myFieldID,strForEmpty -- replaces each marker <%key%>
-- with the content of myArray["key"] in the field wich ID is myFieldID.
-- If myArray["key"] is empty, it replaces the marker with the optional strForEmpty.
put the HTMLText of fld id myFieldID into theText
put the keys of myArray into klist
repeat for each line kk in klist
put empty into t1
if myArray[kk] is not empty then
replace ("<%" & kk & "%>") with myArray[kk] in theText
else
replace ("<%" & kk & "%>") with strForEmpty in theText
end if
end repeat
set the HTMLText of fld id myFieldID to theText
end subsInFld
This way you can create a RTF or HTML template using an external application, load it into the RTFtext or the HTMLText of a field and fill it with your data (possibly coming from a DB).
put the text of field "Field1" into tTemplate -- we'll put this back later
put "Roger Rabbit" into MyName
put merge(the text of field "Field1") into field "Field1"
revPrintField field "Field1"
set the text of field "Field1" to tTemplate.
This should result in hello Roger Rabbit
being printed.