Varying language based on number of items in list and based on genders of persons in a list

Two part question, but similar ideas:

  1. I am creating an “appointment of officer(s)” clause for a consent. If the officers datafield (repeating list) contains 1 person, then I want the title to use “officer.” If the list contains >1 person, then “officers.” Clausebase is set up cleverly to vary number and gender in Concepts and their associated labels, however, it seems a little less straightforward if we are not using a concept label, which in this case, I don’t think we can practically do. I can see how to do this with a conditional letter “s” determined by applying the @count special function to the list datafield, but that is an awful lot of coding for one letter. Is there a better way?

  2. If there is a single officer, I want the clause to use “him” or “her” depending on the person’s gender. Obviously I’ll need a datafield to capture the gender, which would presumably repeat for each officer (or better yet, only be asked if there is just one officer, since in English, the gender would not matter with the plural). How could I do this? I need to use a datafield that won’t actually be displayed in the assembled document.

These are small issues but nice to be able to figure out.


Hi Kenneth,

There are several special functions that deal with this:

  • You can use @one-else — for example, @one-else(@count(#officers^names), “officer”, “officers”) will show “officer” when there is only one item in #officers^names, while it will show “officers” when there are multiple items in there.
  • You can use @singular(#officer) and @plural(#officer) to extract the singular/plural conceptlabel from a certain concept (whatever it happens to be set to).
  • So combined you could use @one-else(@count(#officers^names), @singular(#officer), @plural(#officer)) to dynamically switch between the singular conceptlabel and plural conceptlabel, whatever the conceptlabel happens to be set to.
  1. If you are able to configure the conceptlabel and set it to the right gender (e.g., directly in Assemble Document through the Terms panel, or indirectly through a terms-change in Design Q&A), then this is simple:

1. <#Officer> will use <his: #officer> car to go to the office.

If you captured the gender in a datafield, then you could will need a traditional switch condition:

1.#Officer will use {#officer^gender = "female": her | else: his} car to go to the office.

I see! @one-else looks like the way to go.

The gender solution, I don’t follow. The problem is that I don’t see how I can use concept labels here. The consent could name three different officers with three different titles; there’s not one concept label to use, so I don’t see a way to use that functionality. Am I incorrect?

I misunderstood the gender-related part of your question.

Suppose that you have three officers (Kirk Smith, Jane Johnson and Miranda Peeters), and you want to create:

  • a table that shows the title of each officer (“Mr.” or “Mrs.”)
  • a paragraph that talks about the salary of the first officer (“his salary” vs. “her salary”)

Also suppose that the last name, first name and gender of each officer are stored in three different repeating-list datafields of type text.

If you then write:

|| {#officers^genders = "female": Mrs. | else: Mr.} || #officers^last-names || #officers^first-names ||

{@get(#officers^genders, 1) = "female": Mrs. | else: Mr.} @get(#officers^first-names, 1) @get(#officers^last-names, 1) shall receive his salary in June.

The result will then be:

|| Mr.  || Smith   || Kirk    ||
|| Mrs. || Jane    || Johnson ||
|| Mrs. || Miranda || Peeters ||

Mr. Kirk Smith shall receive his salary in June.

Note: the @get(…) stuff means “extract the Xth element out of a (repeating) list”.

By the way, you will see that the {@get(...) = "female": ... | else: ...} stuff actually gets repeated several times. This can quickly get annoying if you have many different paragraphs. ClauseBase allows you to convert such repetitive parts into snippets (so that you can write @MF(“Mr.”, “Mrs.”) or @MF(“his”, “her”). See for a detailed explanation of how this works.

yes, helped me too, thx!!