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!

Hello,

I have a follow-up question here: is it possible to use option 1 @one-else with two or more datafields?

I have a clause with a list of texts datafield. I followed the instructions in the KB article " How to: create a list with both predefined options and free input" (e.g. a list of payments).

However, I have a clause introducing my datafield(s) that needs to be adjusted depending on the number of fields filled-in by the user in both the predefined input list and the free input list:

#employer will pay the following @one-else(@count(#payments^list_type_payments-predefined), “amount”, “amounts”) to #employee, to the extent @one-else(@count(#payments^list_type_payments-predefined), “it is”, “they are”) not yet paid:

  • AND

  • {“salary end of contract” in #payments^list_type_payments-predefined: the normal gross salary until #termination-date}

  • {“indemnity in lieu of notice” in #payments^list_type_payments-predefined: @INDEMNITYINLIEU}

  • {"vacation pay"in #payments^list_type_payments-predefined: the departure holiday pay, calculated according to the applicable legal provisions}

  • @bullets(#payments^list_payments_free)

How do I make sure that the @one-else(@count) function also take into account the number of elements in #payments^list_payments_free?

Thank you!

Astrid

Hi Astrid,

Welcome to the forum!

Good question. I think what you are looking for, is the @union special function. It allows you to combine two lists into one.

(By the way, as you can read in the help site, there are also related special functions for taking the intersection of two or more lists of elements, or subtracting one list from another).