Making a concept automatically adjust to plural/singular form depending on a number datafield

I was searching how to make a concept automatically adapt to its plural/singular version depending on a user’s input value (ex: the number inserted in a number datafield), but I am feeling a bit overwhelmed by all the special functions and tools I could use for this purpose. Is there a particular special function that would be the best suited for this situation?

Hi Marina,

You are right that ClauseBase offers many options to deal with this situation. For the situation you described , three particular approaches come to mind.

1. @one-else
First, there is the @one-else special function, which takes the following form:

Example: @one-else(#concept^number-datafield, "the singular word", "the plural words").

Instead of writing static text between quotation marks, you could also force the use of a singular version in the second element of the special function (i.e.: “the singular word” would become @singular(#concept) and “the plural words” would become @plural(#concept)). More on that below.

You can see a practical demonstration of this function in our tutorial video ‘Singular and plural special functions’ here.

In addition, we received a similar question in the Community Forum, for which we provided a detailed answer that you can access here.

2. @singular/@plural
The second option would be to create a condition to make ClauseBase retrieve the plural or singular label of a specific concept, depending on the number inserted in a number datafield.

Example: {#concept^number-datafield = 1: @singular(#concept) | #concept^number-datafield > 1: @plural(#concept)}

Naturally, this is just a roundabout way of creating the kind of situation that @one-else envision so the approach under 1. is recommended.

3. Using change sets in Q&A
In Q&A mode, you can make a “change term” change set that changes the use of the default version (singular or plural) of a concept to the other version (plural or singular) based on the fulfillment of a certain condition.

If you make a change set like that and attach a condition to this change set that activates as soon as #concept^number-datafield is more than 1 (for example), that could also automate the switch to a singular or plural version.

For more information on this, check out this Help Center article.

Thank you, Senne!