« Xojo 2018 Release 3 | Home | ChartDirector Plugin … »

Merge field values into text


We got recently a new function Text.MergeFields to merge field values into a text block. This is useful for placeholders in a text sent by email. You just put a <<FirstName>> in the text, the plugin sees the << and >>, takes the text between and looks for a field matching the name. The function definition is:

MBS( "Text.MergeFields"; Text; Flags )

We got a few flags to process. If Flags includes 1, we recognize field names. This can be a simple field name in the current table or a field from related tables with Table::Field notation using two colons.

Add 2 to Flags in order to allow variables. They need to start with one or two $ symbols. We evaluate the value and use it for the text. Variable names can contain spaces, but we don't recommend that.

Next add 4 to allow general expressions. This allows you to call all functions in MBS and other plugins as well as all FIleMaker functions. Great for using some Get functions, but if the user can change this themselves, they can do a lot of damage. If needed, we could maybe add a mode for only allowing Get functions? Let us know if you need that!

If you need values to be properly encoded as HTML or XML, you can get that by adding 16 for XML and 32 for HTML to the flags.

The new function is great for emails. You can have a template referencing fields and fill them when building the email. You could use fields from he current record of the customer you send newsletter to and put in some variables additional content to include. Please try it soon. Coming for version 8.5 and already in the betas.
24 10 18 - 17:57
No comments

  
Remember personal info?

Emoticons / Textile


Notify:
Hide email:

Small print: All html tags except <b> and <i> will be removed from your comment. You can make links by just typing the url or mail-address.