PRULAR Function: Difference between revisions

From Planfix
Jump to: navigation, search
No edit summary
No edit summary
 
(One intermediate revision by the same user not shown)
Line 5: Line 5:
|description= PRULAR Function
|description= PRULAR Function
}}
}}
The PLURAL function selects the correct word form depending on the number preceding the word in a document template.
Used to append a suffix to a word or to change the word itself if it is an irregular noun based on the number given before it in the document template.
== Format ==
== Format: ==
PLURAL(number; "text1"; "text2")
PLURALFORM (number; "text1"; "text2";)


Depending on the calculated value of the number, the function selects one of the two text parameters.
Depending on the calculated value of the number, the function selects one of two parameters. The parameters must be specified in strict order according to the algorithm. 
Assume you need to handle the word "dollar"
 
For example, you need to inflect the word "dollar." Follow the algorithm:
 
First, write the required word with the number 1: 
*1 dollar
 
This means that the first parameter in the function "should be the word "dollar" instead of "text1". 
 
Then, write the word with the number 2: 
*2 dollars
 
This means that the second parameter in the function "should be the word "dollars" instead of "text2".
 
Finally, you can specify the following PLURALFORM() function in the document: <div style="display: block; padding: 1em; margin: 0 0 10px; font-size: 13px; line-height: 1.65; color: black; word-wrap: break-word; background-color: #f9f9f9; border: 1px solid #ddd; border-radius: 4px;"><nowiki>PLURALFORM(SUM({{Datatag.Service.Cost}}*{{Datatag.Service.Quantity}}); "dollar"; "dollars")</nowiki></div>
 
 
== Go To ==
*[[Standard functions]]

Latest revision as of 12:28, 26 November 2025

Used to append a suffix to a word or to change the word itself if it is an irregular noun based on the number given before it in the document template.

Format:

PLURALFORM (number; "text1"; "text2";)

Depending on the calculated value of the number, the function selects one of two parameters. The parameters must be specified in strict order according to the algorithm.

For example, you need to inflect the word "dollar." Follow the algorithm:

First, write the required word with the number 1:

  • 1 dollar

This means that the first parameter in the function "should be the word "dollar" instead of "text1".

Then, write the word with the number 2:

  • 2 dollars

This means that the second parameter in the function "should be the word "dollars" instead of "text2".

Finally, you can specify the following PLURALFORM() function in the document:

PLURALFORM(SUM({{Datatag.Service.Cost}}*{{Datatag.Service.Quantity}}); "dollar"; "dollars")


Go To