Copyright: WYSI-Help 2.102   215080259 ® DDTEC


Instructions for Use
J & S  Mail Merge Templates v1.4 (2003) and v2.0 (C4)

Instructions for use

WHAT'S NEW from version 1.3?

Although this template set is easy to use, it is necessary to follow the general flow described below for it to work.

1. Register the JSMRG.TPL (in 2003) and the JSMRGC4.TPL (in C4) template file. For instructions on registering your templates, see your Clarion for Windows users manual.

2. Add the J & S Mail Merge GLOBAL EXTENSION to your application.

3. Create an import file from your dictionary using the UTILITY TEMPLATE

4. Create a Mail Merge Token File by importing the file that was created in step 3. Use Mergedit.exe..

5. On update procedures where memo editing is done, populate the insert token control template

6. On the REPORT procedures where you wish to do a mail merge, add the Mail Merge Report Extension

7. If you would like to preview or save a merged document without using a REPORT, use the new SimpleMerge CODE Template

8. For non-English language support, you can use JS_EditINI to create an INI file with alternate window prompts.

INFORMATION ON THE BUILT-IN FUNCTIONS

EDITING the .DLL Procedures

WARNING: ANY CHANGES THAT YOU MAKE TO THE MAILMERGE DLLS WILL PUT YOU "ON YOUR OWN". We do not have the time or resources to debug or aid in changes made to our dll procedures.

Because it was requested by a few users, we are making the bulk of the procedures available so that window appearances could be modified to match the "Look and Feel" of their apps. Keep in mind that if you make modifications to the DLL's, you will have to re-do those changes if/when an upgrade release comes out.

The source code for the .DLL's is located at \CW20\JSMMSRCE.


License
LICENSE AND AGREEMENT

J & S Software provides no warranty expressed or implied as to fitness of this product for any particular purpose. J&S shall not be held liable for any amount greater than those funds actually collected by J&S for the purchase of this software excluding any and all handling and shipping costs. You as the user of this product shall not reproduce or distribute this product, except as noted herein. Any violation of this license and agreement will be prosecuted to the full extent of the prevailing law(s) which are applicable. This product has a copyright(c) and is protected by such copyright laws and regulations. As the end user of this product, J&S grants you a royalty free license to distribute the linked executable (EXE or DLL) and no other parts or documentation, printed or electronic, in any form. As the end user you may not reproduce this product in any form other than as noted herein. Use of this software is an indication of your acknowledgment to this agreement and that J&S can not nor will not be held responsible for the use of this software, any loss of business or income from its use or any other damages which might arise from its use or misuse.

Contact Information:

J & S Software

7900 Limonite Ave #G 193

Riverside, CA  92509

909-781-0920

FAX 909-781-8363

CIS 73501,1323

Internet: jeff@jssoftware.com

http://www.jssoftware.com


What is it
J & S  MailMerge Templates

What is J & S Memo Mail Merge, and what can it do for me?

The J & S Mail Merge templates enable you, the Clarion for Windows developer to easily incorporate "Mail Merge" into your applications. "Mail Merge" uses special TOKENS, which the program user can embed in their documents to represent data fields in your program. When a document is printed, these tokens are automatically replaced with the live data from your data files. This allows generic letters to be typed one time and printed numerous times, each with new information inserted where the original tokens were placed.

There are many different places where mail merge can be used, but most commonly it is used in letters to customers, vendors, etc... The letters are typed ONE TIME, using mail merge tokens instead of the customer name, address, contact info, etc... When the letters are printed, and the tokens get replaced with the real data, giving the appearance that the letter was written exclusively for them.

What are some REALLY REALLY REALLY cool things that J & S Memo Mail Merge can do?

In addtion to using tokens to represent data fields, the J & S Mail Merge can also use RUN-TIME CLARION EXPRESSIONS, TOO!!. Yes, that is right. Yes, really. The expressions do not need to be compiled into the program, and can even be modified on-site without CW.

For example, you might have a token called ((--CityStateZIP--)). This token would be replaced by a string such as "Riverside, CA  92509". But wait a minute.... City, State, and ZIP are 3 different data fields. How do you do that? Simple. In your mail merge formula, you would type:

Clip(CUS:City) & ', ' & Clip( CUS:State) & '  '& CUS:ZIP

This is just standard CW code, but it is placed in the merge formula field of the merge data file. This formula is automatically evaluated at print time, and ((--CityStateZIP--)) gets replaced.

If YOU choose to allow your users to create their own mail merge tokens, there are all kinds of cool things that they can do. For example, if an end-user types a lot of letters, he/she might prefer to store his/her signature in a mail merge token. This token might look like this: ((--MyTagLine--)) and it would represent something like:

'Sincerely,

Jeff Herblin

Mail Merge Testing Company'

Notice the quotation marks around the text. If a word/group of characters are not recognized as a variable name, then they MUST BE SURROUNDED BY QUOTES.


Tokens
Mail Merge TOKENS

A Mail Merge Token is simply a unique grouping of characters that represent something. These groupings of characters MUST be unique so that the merging functions don't get confused and create errors. A token can be of any configuration that you would like, and a token can represent any valid clarion data field, expression, or string.

The template default uses 2 left parentheses followed by 2 dashes like so: ((--  but you can use anything that you want to signify your tokens. Some examples:

  ((--CUS:Customer--))could represent the customer field in the customer file.

    ((--Today--)) could represent format( Today(), @d4 )

    ((--MySignature--)) could represent:

'Sincerely,

Jeff Herblin

Mail Merge Template Testing, Inc.'

    ((--CityStateZIP--)) could represent Clip( CUS:City ) & ', ' & CUS:State & '  ' & CUS:ZIP

Mail Merge Tokens are stored in a Topspeed (.TPS) file with the extension (.MRG)

NOTE: There are some combinations of characters within the merge formula that can cause some big problems. You should avoid single quotation marks except for surrounding strings. Sometimes placing 2 single quotes next to each other within other single quotes can cause a GPF in your program, and it is difficult to debug. In order to use your data fields in a mail merge formula, THE DATA FIELDS MUST BE BOUND in your report procedure. Otherwise, the merge function will report an error.


Troubleshooting

I am getting a "**Mail Merge Error**" in my printed document instead of the data that is supposed to go there. What can I check?

1. Make sure that your fields and custom functions used in the merge formula are bound  (using BIND()) in the report that does the mail merge.

2. Make sure that any STRINGS in the merge formula have single quotation marks around them. A "HARD RETURN" character counts as a character that must be surrounded by quotes. A common mistake in the merge editor is to place an extra hard-return after a single quote.

3. Some valid CW expressions, just plain DO NOT WORK with the mail merge function. For example, any @P##P types of picture tokens will cause an error. (See JS_FFormat for a workaround) A good rule of thumb would be that if you can use EVALUATE() on a merge formula without any errors, then it is okay.

4. Make sure that any files that are referred to are opened.

I am getting a mysterious GPF when printing a report with the mail merge extension.

Some combinations of characters, such as certain groupings of single quotes within strings, will cause unpredictable results. As a general rule, you should AVOID the use of single quotes inside strings in the merge formulas.


Requirements

The J & S Mail Merge Templates 1.3 require Clarion for Windows version 2.003 or greater. RichX is optional.


Global Extension

To add the J & S Mail Merge Global Extension to your application, press the GLOBAL button. Click on EXTENSIONS. Click INSERT. Choose the J & S Merge global extension. If you would like to test for the existance of "RichX" at program startup, check the checkbox.

If the box is checked, and RichX is on the user's computer, then the global variable "JS_RichXInstalled" will be set to TRUE. Otherwise, it will be set to FALSE. Depending on whether or not the OCX is available, you could change the behavior of your program.


Utility Template
Field Information Export Utility Template

There is a UTILITY template that will allow you to easily and quickly create a mail merge token file from your existing fields in your dictionary.

On the CW menu bar, click on APPLICATION then TEMPLATE UTILITY. Choose the JS MERGE export utility.

This template creates a "BASIC" comma delimited file that can be read by the MAIL MERGE TOKEN EDITOR. You have the option of exporting ALL file information, or just the specific files that you would like your users to have access to. NOTE: THE MORE FIELDS THAT EXIST IN A MERGE FILE, THE LONGER IT TAKES TO RUN THE MERGE PROCEDURE WHEN YOUR PROGRAM IS RUNNING. If you have any fields in your dictionary with NO POPULATE checked, you can optionally exclude those fields from the export file.

TIP: You can add JSNOMERGE to your user options of either a data FILE or a data FIELD in your dictionary if you don't want it to be included in the export file.


Mail Merge Token Editor

MERGEDIT.EXE is simply a program that uses some procedures from the JSMRG16.DLL to allow you (the developer) to easily edit mail merge token files. You can add the same functionality to your programs if required with the JS_ChooseMergeFile() procedure. It is prototyped as follows:

The JS_ChooseMergeFile() procedure prompts you for the name of the merge file that you would like to open. You can optionally use a password.

When the file is opened, a browse window pops up, displaying the list of available mailmerge tokens. If the "Allow Import" parameter was set to TRUE, then the "Import Field List" button is un-hidden. Otherwise, the "Import Field LIst" button does not appear.

To add a new token to the merge file, press the INSERT button. To change the selected token, press CHANGE. To DELETE the selected token, press the DELETE button.

NEW: There is now a new flag that allows you to specify that specific tokens be "Developer ONLY". If this flag is set, then your users will not be able to modify the token. The only way that this token can be modified is to place the procedure into "DEVELOPER MODE". When in developer mode, you temporarily override any limitations that you had placed on the merge file editor or "Select Token" browse. If you are not in developer mode, then the checkbox for "Is Developer Only" is hidden on the token editor.

NEW: There is now a "Filter" file. This way, you can easily filter groups of mail merge tokens. Depending on the freedom that you give your users, the filters can be edited at run-time. There is a handy "Filter Builder" wizard to assist you. To edit the filter file, press the ellipsis button next to the filter category listbox.

Note below, there are 2 examples of mail merge tokens. You can use either valid CLARION phrases, or.....(see below)

You can use a large string constant contained in single quotes. There are some combinations of characters that can cause problems. See the troubleshooting section.

You can lookup existing data fields by pressing the [...] button.


Importing Field LIst

When the "Import Field List" button is pressed from the token editor, you are presented with this window:


JS_ChooseMergeFile

This procedure is used to open or create a merge file for editing. There is a CODE template that can be used in procedure embeds:

Or, you can hand code the calls as follows:

    JS_ChooseMergeFile(Byte NewFile, <Byte AllowImport>, <*String FileName>, <*String Password>)

   1. The first parameter specifies that you want to create a new mail merge data file.

   2. The second parameter specifies that you want to allow the user to import a field list from the file created by the utility template

   3. The third parameter (optional)could be the name of a data field where you can store the filename if desired. There are no templates to handle this for you.

   4. The fourth parameter (optional) could be the name of a data field where you can store the password of the merge file. There are no templates to handle this for you, but it is there if you need it.

Other Built-In Functions


Insert Token Control Template

For inserting tokens into RichX controls, click here.

To allow your users to insert mail merge tokens into their document, you need to populate the "insert token" control template on your window. In the appgen window formatter, click POPULATE then click CONTROL TEMPLATE then choose the JS Mailmerge insert token template. After you place the button on the window, you need to fill in the prompts.

You need to tell it which window control and which data field you will be effecting. You must specifiy a merge file name, and an OWNER ID if applicable.

If you want your user to be able to modify the file, check the "Allow user to update file" checkbox. Unless your users are really really sharp, it is not recommended that you give your users this power. If you, as the developer would like to be able to modify tokens at run-time, press CtrlAltD when the token listbox is opened. This will put you into "Developer Mode"


Mail Merge Report Extension

This template generates the code that calls the merging function.

You must enter the name of the data field that contains the text to be merged. You also need to specify the text control that prints the memo/string.

If the merging function finds an error in the merge formula of one of the tokens, you can specify text to print in its place. If desired, leave this entry blank.

You MUST specify at least one merge token file to check.


JS_EditINI

To allow for the language flexibility requirements that many developers have, all procedures in the mail merge .DLL use an .INI file to derive their text from. If there is no INI file available, then the default language is english.

The name of the INI file that the .DLL looks for is JSMRG.INI. It can be created and modified using the JS_EDITINI procedure. There is a code template that can be used for calling the procedure if you want to include the procedure in your programs, or you can just use MERGEDIT.EXE to call it.  You must place this .INI file in your users' WINDOWS directory.

Template Prompts:

Or, to call in code, just type:

JS_EditINI

Other Built-In Functions


SimpleMerge Code Template
Simple Merge

There is a new CODE template for MailMerge 1.3.  This template simply replaces the tokens in a document, and copies it to another string or memo. This can be useful if your client wants to save a copy of a letter printed, or just to view what the letter will look like when merged.

1. Specify the "Data field to Merge". This is the document that contains mail merge tokens.

2. Specify the "String or Memo to Receive". This can be either a memory variable, or a file field. When the code from this template is executed, this is the string that will contain the merged document (meaning that the tokens will have been replaced with real data).

3. Specify the error text to appear if there is an error in the merging of a particular token. Errors can occur if there is a syntax error in the token formula or if a field is not properly bound.

4. List the merge files that you would like to be read. There needs to be at least one.

5. "Reprocess until tokens gone" - This causes the merge to repeat until there are no tokens. This is useful if there are recursive tokens (Tokens within tokens).

It is up to you to decide what to do with the merged document after this code is executed.


Developer Mode

"Developer Mode" allows you (the programmer) access to the mail merge editing procedures, even if you don't allow your users to edit tokens.

There are 2 places where you can invoke "Developer Mode":

1. From the JS_GetToken() function:  Press CtrlAltD.

2. From the BrowseTokens procedure. Press CtrlAltD.

Of course, it is a good idea to not tell your users about this.

On the "BrowseTokens" window, there are a few buttons unhidden when "Developer Mode" is invoked:

1. "Import Field List"

2. "Print Tokens"

3. "Import/Export"


Batch Merge Printing RichX
RichX printing and processing

For processing and printing merged batches of documents using RichX, there is JS_RichBatch EXTENSION template. This template has has several very useful functions. It can be used to:

1. Merge and print a document for many records.

2. Batch convert a normal text memo or BLOB to RTF. (with or without merging)(with or without printing)

3. Batch convert an RTF memo or BLOB to normal text. (with or without merging)(with or without printing)

4. Send BLOB, MEMO, or disk file to BLOB, MEMO, or disk file (with or without merging)(with or without printing)

This template works with either the Clarion/ABC PROCESS template, or the CPCS UnivProcess template.

Explanation of prompts:

1. Source of RTF:

 	The RTF/Text can either come from a MEMO, BLOB, or DISK file. You (The Programmer) are in charge of making sure that the MEMO, BLOB, or DISK file name is current. This means that if you use a MEMO or BLOB, that the proper record of the file is in the record buffer. If you are using a disk file, then you need to make sure that the filename is valid.

2. Source Type:

You can specify either RTF or TEXT as the source. If you specify RTF, it is expected that the text is in Rich Text Format. If you specify TEXT, then it is expected that the source is just plain text.

3. Target of RTF:

Just like the "Source of RTF" prompt, you can specify the target. This is an optional prompt. If you do not wish to save the processed text, then choose "Do Not Save". Otherwise, specify MEMO, BLOB, or DISK file.

4. Target Type:

You can specify either RTF or TEXT as the target type.

5. Perform Merging:

If you wish to merge your data into the document, this prompt should be set at "Perform Merging" (default). If you wish not to merge, select "Do Not Merge".

6. Printing:

If you wish to print the documents that you are processing, set this prompt to "Print Documents". If you only wish to perform processing without printing, select "Do not Print".

7. Merge Filename

If you are performing a mailmerge, there will be a tab that says "Merge File". Under "FileName", enter the name of the merge file.

8. Owner ID

If you choose to encrypt your merge file, enter the owner id.

9. Stream File to use:

Depending on the source of your Text or RTF, there will be a tab that says "Source Memo", "Source BLOB", or "Source FILE". You need to tell the template which MEMO, BLOB, or FILE that you are loading the RichX control from.

10. Target

Although not shown in this picture, if a target MEMO, BLOB, or FILE had shown, there would be a place to enter the target for the RTF/text.

NOTE: This template does nothing to manage the writing of disk files or putting of the correct record. There are embeds supplied for you to enter this code.

11. Includes

If you haven't otherwise included the OCX.CLW or  OCXEVENT.CLW in your map, this is a handy way to do it. If you have, then leave these boxes unchecked.


Built In Functions
Built-In Functions

The J & S MailMerge DLL has several procedures and functions available for you to use. Most of them are called and used by the templates, but the brave-hearted might want to call them directly. Here is a brief explanation of each of them:

NOTE: It might look like we went a little bit nuts with the "JS_"'s. Contrary to what you might believe, this is not done for vanity. The purpose of this is to (hopefully) avoid any clashes with other 3rd party developers, and (hopefully) cause you less grief.

The map statement

Click on the name of the desired procedure/function for information regarding its use.

  Module('J&S Mail Merge')

    JS_InsertToken(String FileName,<String Password>,Short PassedControl,*String PassedString,<Byte AllowUpdate>,<String PassFilter>,<String WindowCaption>)

    JS_ReplaceTokens(*String PassedString, String FileName, <String Password>, <String ErrorMessage>, <Byte ReTest>),byte

    JS_EditINI

    JS_Cap(String),String

    JS_ChooseMergeFile(Byte NewFile, <Byte AllowImport>, <*String FileName>, <*String Password> )

    JS_MRGVersion(), String

    JS_RichXRetrieveToken(*CString ReplacementText, String Token, <String ErrorMessage> ), Byte

    JS_RichXIsInstalled(),BYTE

    JS_OpenMergeFile(String FileName, String Password)

    JS_CloseMergeFile

    JS_FFormat(String FValue, String FPicture ),String                                                                   end


RichX
RichX RTF Editing OCX

"RichX" is an OCX for the editing of RTF (Rich Text Format) files. It can be gotten from http://www.x-gen.com. If you don't have RichX, you can download a 30-day demo.


insert token template RichX
Inserting a token into a RichX Document

If you would like to insert tokens into a non-RichX document, click here.

To insert a token into a RichX document, there is a CODE template that you can place into the embed.of your choice. You need to specify which RichX control the code will refer to, and let it know which merge file to look up. You can optionally allow the user to update the file by checking the checkbox.


Merging Tokens RichX
Merging Tokens in a RichX document

To merge (or replace) all of the tokens in a RichX document, use the JS_RichXReplaceTokens CODE template. All you need to do is specify which RichX control you are refering to, and which mailmerge token file that you are using.


JS_InsertToken

Purpose: Place a mailmerge token into a text or entry control. If you normally use the templates, you can use the "Insert Token" control template.

Here is the prototype:

JSInsertToken(String FileName, <String Password>, Short PassedControl, *String PassedString, <Byte AllowUpdate>,<String PassFilter>,<String WindowCaption> )

Usage example:

JS_InsertToken( 'mailmrge.mrg', 'Rudy', ?TextString, TextString, 1,|

'Instring( 'RUDY',Upper(JSM:Description),1,1)',|

'Rudys Tokens' )

Explanation:

1st parameter: 	'mailmrge.mrg' is the name of the mailmerge token file to open.

2nd parameter:	'Rudy' is the password (Owner ID) for the mailmerge token file. You can leave an empty string ('') if you don't wish to use a password.

3rd parameter:	?TextString is the field equate label for the TEXT control that is receiving the token.

4th parameter:	TextString is the label of the large STRING that is the USE variable of the TEXT control. If the actual use variable of the TEXT control is NOT a string (i.e. a MEMO, CSTRING, etc..), then you must place a string OVER the memo or Cstring then pass the STRING.

5th parameter:	1. This means that you want to allow the end user of the program to be able to modify the token file. If you don't want them to be able to make changes, then you can omit this parameter. You (the developer) can still get into the tokens by going into developer mode.

6th parameter	'Instring( 'RUDY',Upper(JSM:Description),1,1)'  This means that only tokens with "RUDY" in the description will show. Passing a filter will also hide the filter list on the insert token listbox.

7th parameter	"Rudys Tokens". This is the caption of the window.

Other built-in functions


Print Tokens

NEW!

You can now print tokens. To do so, you must be in Developer Mode.


JS_ReplaceTokens

Purpose: Replaces mailmerge tokens within a string. If you normally use the templates, then you could use the SimpleMerge code template, or you could use the JS_RichXReplaceTokens template if this is for RichX.

Here is the prototype:

JS_ReplaceTokens(*String PassedString, String FileName, <String Password>, <String ErrorMessage>, <Byte ReTest> ),byte

Usage:

NOTE! If you are using RichX, then you need to use the JS_RichXRetrieveToken function in addition to some other steps instead of this function.

If JS_ReplaceTokens( TextString, 'mailmrge.mrg', 'Rudy', '***Mailmerge Error***', 1)

    Do ErrorHandling  !Means that there was an error in the merge

end

Explanation:

1st Parameter:	TextString - The label of the STRING variable that contains the document text.

2nd Parameter	'mailmrge.mrg' - The name of the mailmerge token file to use.

3rd Parameter	'Rudy' - The password (owner ID) for the mailmerge token file.

4th Parameter	'***Mailmerge Error***' - The replacement text that you want to show in your document if there is a problem with your token formula. Usually an error occurs if there is improper syntax used.

5th Parameter	1 - This parameter tells the function to re-check the text for tokens after a replacement has been done. This is to support recursive tokens ("Tokens within Tokens"). If the parameter is zero or omitted, then the recursive merge will not be performed. If it is unlikely that you would have tokens within tokens, then you should leave this as a zero to improve performance.

Other Built-In Functions


JS_Cap

Purpose: Applying "Proper" case to a string. For example: "joe blow" would become "Joe Blow" when passed through the JS_Cap() function.

Usage:	In a token formula, you would just type:

JS_Cap( YourString )

NOTE: You do not need to BIND this function for use in the mailmerge token formula. It is already done for you.

You could however use this function anywhere you would like. To make a string "proper" case, type:

YourString = JS_Cap( YourString )

Other Built-In Functions


JS_MRGVersion

Purpose: Returns a string with information about the version and build of this version of mailmerge.

Usage:

MyString = JS_MRGVersion()

Other Built-In Functions


JS_RichXRetrieveToken

Purpose: Retrieve a the replacement text for a token in a RichX document. This function is for RichX use only. If you normally use the templates, then you should not need to call this procedure manually.

Here is the prototype:

    JS_RichXRetrieveToken(*CString ReplacementText, String Token, <String ErrorMessage> ), Byte

Usage: This function is designed to be used in conjunction with calls to the RichX class wrapper that comes with RichX. Here is the general flow of how the code must flow:

         JS_OpenMergeFile( 'MRGEDEMO.MRG', '' )!Open the token file

        LOOP RichX:Ndx = 1 TO cxOleRichX.GetTokenListCount()!X-Gen code to loop through tokens.

          CLEAR(RichX:Replacement)!Clear the CString that holds the replacement text.

          RichX:NameToken    = cxOleRichX.TokenListItem(RichX:Ndx)!X-Gen code

          If JS_RichXRetrieveToken (RichX:Replacement, RichX:NameToken, '**MailMerge Error**' )

            Do ErrorHandling !Returns TRUE if there was an error.

          end

          cxOleRichX.ReplaceToken(RichX:NameToken,RichX:Replacement)

        END

         JS_CloseMergeFile !Close the token file

Other built-in functions


JS_RichXIsInstalled

Purpose: To check if RichX is registered on the users computer. This way, you can optionally disallow the user to open procedures that are designed to use RichX, and avoid unprofessional looking blank windows. This function reads the Windows registry for the unique RichX CLSID.

Usage:

MyByteVariable = JS_RichXInstalled()

This function returns TRUE (1) if RichX is detected, and FALSE (0) if it is not.

Other Built-In Functions


JS_OpenMergeFile

Purpose: For opening a mailmerge token file to be processed. If you normally use the templates, then you most likely will not need to manually call this procedure.

Requirements: The merge token file must be closed with JS_CloseMergeFile following the use of this procedure.

Here is the prototype:

JS_OpenMergeFile(String FileName, String Password)

Usage:

JS_OpenMergeFile( 'ToknFile.mrg', 'Rudy' )

Other built-in functions


JS_CloseMergeFile

This function should only be called after the JS_OpenMergeFile had been called. If you are mainly a template user, you should not need to call this function.

Other Built-In Functions


JS_FFormat

Purpose: In the Mail Merge Token Editor's merge formula, you can put many Clarion functions, and many of them work. One in particular that doesn't work, is the use of the Format() function with an @P styled picture token. This is not a J&S Mailmerge bug, but a CW bug.

We discovered a workaround that enable you to use @P styled pictures in your merge formulas. The JS_FFormat() ("Friendly Format") function is used the same way as the CW Format() function, exept that the parameters passed must be STRINGS.

Here is the prototype:

JS_FFormat(String FValue, String FPicture ),String

NOTE: You do not need to BIND this function for use in the mailmerge token formula. It is already done for you.

Usage:

In the mailmerge formula editor:

JS_FFormat(YourStringVariable, '@P###-##-####P') !Notice that the picture token is in quotes.

In normal Clarion code:

String1 = JS_FFormat( YourStringVariable, '@P###-##-####P') !Notice that the picture token is in quotes.

Other Built-In Functions


Import Tokens
Importing and Exporting Tokens

When in Developer Mode, you can now import and export filtered subsets of tokens to and from one token file to another!!

While browsing a token file from the "BrowseTokens" procedure, invoke "Developer Mode" by pressing Ctrl_Alt_D.  The "Import/Export" button will appear at the bottom of the window. Press it <g>, then the window below will appear.

Due to the somewhat complex nature of this window, it is only intended for use by developers.

1. File to export to - The name of a valid .MRG file. If the file doesn't exist, it will be created. If an existing file is not a valid .MRG file, then an error will occur. If the "Action" is set to "Import", then this field will represent "File to Import from".

2. Password - the owner ID of the file.

3. Record Filter - This should be a valid Clarion filter expression.  All of the field names in the .MRG file are available for use in the filter, and there is a listbox on the window containing those field names for your convenience. Just double-click on the desired field name to paste it into your filter expression.

4. Behavior for Duplicates - Action to take if duplicate records are encountered during import/export.

5. Field List box - A handy list of all of the fields in the .MRG file. Double-clicking on the field name pastes it into the Record Filter.

6. Purge Export File before Export - Clears all records out before the export starts.


Whats New
What's New?

New to Version 1.4(2003) and 2.0(C4)

1. Added more functionality to the JS_RichBatch template. Now, this template can be used for converting text memos to RTF, and visa versa.

2. Added a recursion option to the JS_ReplaceTokens function (non-RichX merging). Now, you can place tokens within tokens (within tokens...).

3. Added a Filter parameter to the JS_InsertToken function. When a filter is passed, the tokens shown are limited to that filter. The window caption can also be passed.

4. Included a "Find/Replace" template. This template adds an OOP class to your application for Find and Replace (Text controls only). Works in 2003 and C4. Free to registered users of Mailmerge version 2.0 and higher.

5. Modified the templates to work with C4's ABC template chain.

6. Modified the RichX.TPL to work with the ABC template chain.

7. Separated the sample applications into RichX samples, and Non-RichX samples.