Page 1 of 1

Using variable in text to print

PostPosted: Mon May 01, 2017 6:20 am
by BRobinsonS
I have an app to create and edit different custom letters.
The text is stored in a DBPro table and printed using Report Designer.

The header is the same but text varies.

The text is plain text but I want to use variable(s) in the text to personalize the text.
Is there a way to do this Report Designer?

Re: Using variable in text to print

PostPosted: Mon May 01, 2017 7:45 am
by Gaev
Brian:

I have an app to create and edit different custom letters.
The text is stored in a DBPro table and printed using Report Designer.

The text is plain text but I want to use variable(s) in the text to personalize the text.
Is there a way to do this Report Designer?

Have you looked at the PopulateStr command ... one of NeoBook's hidden gems.

With it, you can define a plain text file as a kind of "Template" (with interspersed Text and NeoBook Variables) ... then issue this command to ...

- read this Template file
- replace all NeoBook Variables with their current values
- store the result in a specified variable

in your case, you could do a FileWrite of your "custom letter template stored in DBPro Table record" before issuing this command ... and then another FileWrite of the result of the PopulateStr command ... and finally, use PrintTextFile or PrintdataFile to print the content.

Re: Using variable in text to print

PostPosted: Mon May 01, 2017 9:05 am
by BRobinsonS
Thanks for the tip.
I'll work on that.