Jump to content

This topic is 8271 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted

Hello FM users!

A question: Is there a way to insert a letter merge field into a standard text field?

I have layouts (hundreds, actually) in my db that are letters that can be printed. Instead of giving users access to Layout Mode in order to change the text of a letter, I just made a text field that contains the body of the letter. I ran into a problem the other day when I wanted to add a merge field into the body of the letter. I don't know how.

Anyone have any ideas?

Thanks very much

Ken

Posted

Kenneth,

what you can do is insert merge tags <<name>>, <<address>> etc inside the field.

Then, when it comes to printing, you can use a nested substitute if more than one merge field to insert the relevant information

Set Field [letterbody, Substitute(Substitute( letterbody, "<<Contact>>", Contact Name field), "<<Company>>", Company Name field)

HTH

Posted

Thanks alot for the reply, Andy. My stomach is twisting in knots thinking of having to nest the Set Field function in all 100+ of my printing scripts.

Regards,

Ken

Posted

No, no. The+ nested Substitute[] is a calculation field that "processes" the field that the merge fields are in. The final layout (for printing) has the calculation field on it. Nothing to script, but some layouts to change.

The only disadvantage of this system is that the field that users enter into is not the field that gets printed, so any formatting (text or paragraph) or tabs applied to the entry field do not transfer to the printed version.

A big limitation for some, but otherwise a cracker of a system. I've used it and once its limitations are known it works very well -- users are pleased to have control.

Posted

Thanks for straightening me out, Vaughan. I was thrown off when andy said "Set Field Substitute..."

I don't see formatting as a problem... these are your typical business style brief letters.

Everything was peachy until the powers that Be wanted to be able to modify these letters. Originally I wanted to export found sets to MS Word and automate printing. But I didn't design the db properly from the beginning to do all that.

Ken

Posted

Tom,

Do a manual export of a small found set.

Save the file as a merge type.

This keeps the field names, for when you place them in your word document.

Now, you can then write a script that does

Export [ restore export order, perform without dialog].

#You can also specify the filename if you want it to go to the same file over and over again, otherwise leave it blank.

HTH

This topic is 8271 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.