On this page
code
Functions
String functions
ន ៅ ព េ ល ធ ្ វ ើ ជ ា មួ យ strings ក ្ ន ុ ង expressions, ប ្ រ ើ single quotes (’’) ។ Exception: ប ្ រ ស ិ ន ប ើ ចង ់ include single quotes ក ្ ន ុ ង string, ប ្ រ ើ double quotes ("") ។
rtSurvey គ ា ំ ទ ្ រ functions ផ ្ ស េ ង ៗ:
string(field): Convert field ទ ៅ string ។string-length(field): Return length ន ៃ string field ។substr(fieldorstring, startindex, endindex): Return substring ។concat(a, b, c, ...): Concatenate fields ។linebreak(): Return linebreak character ។lower(): Convert string ទ ៅ lowercase ។upper(): Convert string ទ ៅ uppercase ។
select_one and select_multiple functions
count-selected(field): Return ចំ នួ ន items ដ ែ ល selected ក ្ ន ុ ង select_multiple field ។selected(field, value): Return true ឬ false ។selected-at(field, number): Return selected item ន ៅ position ជ ាក ់ ល ា ក ់ ។choice-label(field, value): Return label ស ម ្ រ ា ប ់ choice ។
Repeated field functions
join(string, repeatedfield): Generate string-separated list ន ៃ values ។join-if(string, repeatedfield, expression): ដ ូ ចjoin()ប ្ រ ស ិ ន ប ើ expression true ។count(repeatgroup): Return ចំ នួ ន times ដ ែ ល repeat group ត ្ រ ូ វ ប ា ន repeated ។count-if(repeatgroup, expression): ដ ូ ចcount()ជ ា ម ួ យ expression ។sum(repeatedfield): គ ណ ន ា sum ន ៃ values ទ ា ំ ង អ ស ់ ។sum-if(repeatedfield, expression): ដ ូ ចsum()ជ ា ម ួ យ expression ។min(repeatedfield): គ ណ ន ា minimum ។max(repeatedfield): គ ណ ន ា maximum ។index(): Return index number ន ៃ current group instance ។indexed-repeat(repeatedfield, repeatgroup, index): Reference field ក ្ ន ុ ង repeat group ពី ក ្ រ ោ ម ។
Number functions
| Operator | Operation | Example | Example answer |
|---|---|---|---|
+ | Addition | 1 + 1 | 2 |
- | Subtraction | 3 - 2 | 1 |
* | Multiplication | 3 * 2 | 6 |
div | Division | 10 div 2 | 5 |
mod | Modulus | 9 mod 2 | 1 |
number(field): Convert value ទ ៅ number ។int(field): Convert value ទ ៅ integer ។round(field, digits): Round numeric field ។abs(number): Return absolute value ។pow(base, exponent): Return value ្ ល ើ ក ។sqrt(fieldorvalue): Return square root ។pi(): Return value ន ៃ pi ។
Date and time functions
Date values ក ្ ន ុ ង rtSurvey ត ្ រ ូ វ ប ា ន store ជ ា strings ក ្ ន ុ ង format YYYY-MM-DD ។ ប ្ រ ើ decimal-date-time() ដើ ម ្ ប ី convert ទ ៅ number ស ម ្ រ ា ប ់ arithmetic ។
today(): Return today’s date ជ ា stringYYYY-MM-DD។now(): Return current date and time ជ ា ISO 8601 string ។date(value): Convert value ទ ៅ date string ។date-time(value): Convert value ទ ៅ datetime string ។decimal-date-time(value): Convert date/datetime string ទ ៅ decimal number ។format-date(date, format): Format date value ។- Format tokens:
%Y(4-digit year),%m(month),%d(day) - Example:
format-date(today(), '%d/%m/%Y')→'15/03/2024'
- Format tokens:
តើទំព័រនេះមានប្រយោជន៍ទេ?