Adjusting the Space Around a Variable

Unless otherwise specified, Partner will fill in 15 spaces for each variable in a letter. This default space works fine for items in a list, but may look strange if you use variables in the middle of a sentence.

Eliminating Extra Space

Consider the following salutation:

Dear <aname>,

If the recipient account’s name is “Al Wells” then Partner will take up 15 spaces before printing the comma after his name. In other words, your letter would print like this:

Dear Al Wells       , 	

You can use variable formatting symbols to change how empty spaces are handled. If you add the symbols “;%s” Partner will use only the number of spaces it needs when filling in the blanks. Tell Partner to only use the eight spaces of the name “Al Wells” like this:

Dear <aname;%s>, 		

The letter will print out like this:

Dear Al Wells, 		

As seen in this example, adding ;%s to Partner variables will make your form letters appear much nicer.

Precise Variable Positioning

The “;%s” command characters will work best for most formatting needs. But sometimes you may need to specify exactly how many spaces a field can take up in a letter. If you needed to create columns and rows, for example, you could make each variable take up exactly 20 spaces. You might also need to control whether the text is right or left justified. Finally, you may wish to show only the first eight character’s of a patient’s name, and chop off the end of a name if it is longer.

In order to see how all of this works, we will examine a formatted variable which uses all of these features. Here is an example showing a lot of formatting for a variable:

<aname;%-20.10s>

As you can see, extra characters were added between the percent sign and the letter “s”. The extra characters are what define the formatting of the variable. These symbols appear in a specific order. Here is a breakdown of the above example, showing the proper ordering of the characters and describing how each portion affects the formatting of the variable:

From the Example AboveDescriptionPurpose/Explanation
<angle bracketIndicated the beginning of the variable declaration
anamewordThe name of the Partner variable
;semicolonSeparates the variable from the formatting information
%percent signIndicates the beginning of the variable formatting information
minus signLeft-justifies (aligns) the variable
20numberIndicates the minimum number of characters the variable should fill
.periodUsed to separate the space and character values
10numberIndicates how many characters from the variable should be displayed
s, dthe letter ‘s’ or ‘d’Indicates that the variable is a string of letters, not numbers. Use ‘d’ for digits, instead.
>angle bracketIndicates the ending of the variable declaration

String all of these elements together, translate them into English, and:

<aname;%-20.10s>

Becomes:

“Print out the guarantor account’s name in a field that takes up a total of twenty spaces, but only fill in the first ten characters of the name, justified to the left of the 20 character space.”

Note: Advanced formatting is optional. For example, you might not want a left-justified variable. If you leave the dash (-) out of the above example, the variable will right-justify. Only use the dash when you want the variable to be left-justified.

The “20.10” numbers above specify a minimum and a maximum space allowed for the text content. If you want the field “aname” to take up exactly eighteen spaces, just enter: <aname;%18s>.

Working with Digits: When you use a ‘d’ instead of an ‘s’, the variable will be interpreted as a digit, leading to slightly different behavior. For example, if you specify that more characters should be displayed in a digit than are available, the variable may appear with extra zeroes. The variable <p.pcc;%6.6d> for a patient with PCC number 3313 will appear as “003313”.

Other Variable Space Formatting Samples

Here are other examples of formats and how they print. For this example, the account name is “Billy A Gillespie” with seventeen characters.

FORMAT                        RESULT 
_____________             ________________________________ 
<aname>                   ‘Billy A Gillespie            ‘ 
<aname;%s>                ‘Billy A Gillespie’ 
<aname;%20s>              ‘   Billy A Gillespie’ 
<aname;%-20s>             ‘Billy A Gillespie   ‘ 
<aname;%20.5s>            ‘               Billy’ 
<aname;%-20.5s>           ‘Billy               ‘ 
<aname;%7s>               ‘Billy A Gillespie’ 
<aname;%7.7s>             ‘Billy A’
  • Last modified: August 3, 2015