Use Google to find help fast. For example, search on "xpressdox choosefromlist".

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