Handling gender

by Peter on September 14, 2009

in XpressDox Cookbook

Suppose you have a document which you want to personalise as far as pronouns are concerned. In other words, instead of having “he/she” in many places, you want to have only “he” or “she” depending on the sex of the party concerned. This could be done by determining the sex up front at the beginning of the template like this:

<<ChooseUsingCheckBox(PartyIsMale)>>

Using <<When()>> for singular values

And then in the body of the template, whenever the document would previously have had “he/she”, put:

<<When(PartyIsMale = “true”,he,she)>>

While this is nice, it is a bit tedious to type <<When(PartyIsMale = “true”,he,she)>> wherever it is required. If there are many places where “he/she” is to be replaced, then one way to create a shortcut is to use a variable, like this:

<<ChooseUsingCheckBox (PartyIsMale)>>
<<If(PartyIsMale = “true”)>>
<<SetVr(“he”,”he”)>>
<<Else()>>
<<SetVr(“he”,”she”)>>
<<End()>>

Then, in all the places where “he/she” is to be replaced, instead of using the “When” above, just type:

<<GetV(“he”)>>

Even nicer is that you can handle “him/her” and “his/her” in the same way:

<<ChooseUsingCheckBox (PartyIsMale)>>
<<If(PartyIsMale = “true”)>>
<<SetVr(“he”,”he”)>>
<<SetVr(“him”,”him”)>>
<<SetVr(“his”,”his”)>>
<<SetVr(“Mr.”,”Mr.”)>>
<<Else()>>
<<SetVr(“he”,”she”)>>
<<SetVr(“him”,”her”)>>
<<SetVr(“his”,”her”)>>
<<SetVr(“Mr.”,”Ms.”)>>
<<End()>>

Then the following becomes possible:

If <<GetV(“he”)>> makes a written request, then <<GetV(“his”)>> copy will be sent directly to <<GetV(“him”)>>.

Using <<Gender()>>

Particularly when there might be more than one party being referred to, then the document in its original form might have had “he/she/they” or “his/her/their” scattered throughout the document.

Probably there will have been some place in the document where the parties were enumerated, and hence a snippet of the document might have been:

The parties to the agreement are:

<<ForEach(Party)>>
<<If(position() > 1)>>

and
<<End()>>
<<PartyName>> <<ChooseFromRDBList(PartyGender,Male,Female,Entity)>>(<<PartyGender>>)
<<End(ForEach)>>

Then at some point later on in the document, outside the scope of the ForEach the document has wording like:

… ensure that his/her/its/their contact details are provided.

The Gender function can be used as follows:

… ensure that <<Gender(PartyGender,count(Party),'his,her,its,their')>> contact details are provided.

Please see the article The Gender Function for additional interesting information on how to use Gender.

Related posts

{ 2 comments… read them below or add one }

Sandeep Verma November 4, 2010 at 9:25 pm

Can you also use the code above and add a Mr. and Ms. Clause based on the gender? I am not able to do it in my letters so thought I’d ask. Please let me know as I’d like to use the gender to fill out his/her, him/her, he/she, and Mr./Ms.

Thanks

<><><>
<><><><><><><><><>

Reply

Charl November 5, 2010 at 8:15 am

Certainly Sandeep. I’ve added the code you need to the example in the Handling Gender article. When you need to use the variable in your document, simply use this code: <<GetV(“Mr.”)>>.

Reply

Leave a Comment