XpressDox Help Center

Use Google To Find Help Fast, e.g. xpressdox choosefromlist


Press Getting Started in the XpressDox toolbar for basic template development
Watch the tutorial videos
View command help from list of commands
Press F1 for help on a command in the Command Editor
Email support@xpressdox.com for assistance

Use Chr to make an apostrophe


Use Chr to make an apostrophe

Suppose you want to set up a variable (called ‘Party’)  to contain either Defendant or Plaintiff, depending on PartyType and then a variable containing the possessive case of that  – i.e. the value should be “Defendant’s” or “Plaintiff’s”.  The apostrophe is going to give trouble.

Here’s how to do it.  First set the variable:

«SetVr('Party','Defendant')»
«If(PartyType = 'P')»
«SetVr('Party','Plaintiff')»
«End()»

(You could have used an «If()» … «Else()» …  «End()» construct, but this way saves typing one «Else()».  If you want to be ultra-efficient.)

Then, what you would sort of like to do is

«SetVr('Possesive',concat(GetV('Party'),''s'))»

but that will cause an “unbalanced quotes” error.

The answer is to use the Chr Function:

«SetVr('Possesive',concat(GetV('Party'),Chr(39),'s'))»

Other Characters

Of course, Chr is very useful for inserting other difficult characters such as the “&” character Chr(38) and “smart” quotes like ‘.  This is Chr(700). The web site here gives a table of all Unicode characters and their numeric values. Note that these numeric values are mostly in hexadecimal, which need to be converted to decimal for the Chr function. There are many web sites, and even the Windows calculator, which will do this conversion for you.

 

Leave a Reply