You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: source/functions_xls.md
+5-6Lines changed: 5 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -20,7 +20,7 @@ The following functions are some of the most frequently used in XLSForm. They he
20
20
|`count-selected(${question_name})`| Returns the number of options selected in a `select_multiple` question. |
21
21
|`coalesce(${question1}, ${question2})`| Returns the first non-empty value of the two arguments. Returns an empty string if both are empty or non-existent. |
22
22
|`jr:choice-name(choice_name, '${question_name}')`| Returns the label value, in the active language, associated with the `choice_name` in the list of choices for a select type question. To retrieve the label of whichever response was selected, use `jr:choice-name(${question_name}, '${question_name}')`. |
23
-
|`selected-at(${question_name}, n)`| Returns a selected choice in a `select_multiple` question at the nth position. For example, `selected-at(${question_name}, 2)` returns the second choice selected in a `select_multiple` question. |
23
+
|`selected-at(${question_name}, n)`| Returns a selected choice in a `select_multiple` question at the n<sup>th</sup> position. For example, `selected-at(${question_name}, 2)` returns the second choice selected in a `select_multiple` question. |
24
24
|`once(expression)`| Evaluates an expression only once (e.g., to ensure a random number is only generated once, or to store the first value entered for a question even if the response is changed later). |
25
25
|`instance('list_name')/root/item[name = ${question}]/column_name`| Retrieves a value from the choices sheet. Searches the choice list named `list_name`, finds the row where the choice `name` matches the response to `${question}`, and returns the value from the column specified as `column_name`. |
26
26
@@ -34,12 +34,11 @@ The following functions are used to perform mathematical operations or transform
34
34
|`round(number, places)`| Rounds a decimal value to a predetermined number of decimal places. |
35
35
|`pow(number, power)`| Calculates the power of a number. |
36
36
|`number(x)`| Converts x (a string or boolean expression) to a number value. |
37
-
|`log(number)`| Returns the natural log of a number. |
38
-
|`log10(number)`| Returns the base-10 log of a number. |
37
+
|`log(number)` <br> `log10(number)`| Returns the natural log or base-10 log of a number. |
39
38
|`abs(number)`| Returns the absolute value of a number. |
40
39
|`sin(number)` <br> `asin(number)` <br> `cos(number)` <br> `acos(number)` <br> `tan(number)` <br> `atan(number)`| Returns the sine/arc sine, cosine/arc cosine, or tangent/arc tangent of a number. |
41
40
|`sqrt(number)`| Returns the square root of a number. |
42
-
|`exp(x)` <br> `exp10(x)`| Returns e^x. |
41
+
|`exp(x)` <br> `exp10(x)`| Returns e^x or 10^x. |
43
42
|`pi()`| Returns an approximation of the mathematical constant π. |
44
43
45
44
<pclass="note">
@@ -73,8 +72,8 @@ The following functions are used to record, format, and calculate date and time
73
72
|`today()`| Returns the current date without a time component. |
74
73
|`now()`| Returns the current date and time in ISO 8601 format, including the timezone. |
75
74
|`date('YYYY-MM-DD')`| Forces dates into the correct date format (especially for dates before 1970). |
76
-
|`format-date(date, format)`| Returns date as a string formatted as defined by <code>format</code>. Common formats include: <ul><li><code>%Y</code>: 4-digit year</li><li><code>%y</code>: 2-digit year</li><li><code>%m</code>: 0-padded month</li><li><code>%n</code>: numeric month</li><li><code>%b</code>: short text month (Jan, Feb, Mar…)</li><li><code>%d</code>: 0-padded day of month</li><li><code>%e</code>: day of month</li><li><code>%a</code>: short text day (Sun, Mon, Tue…)</li></ul> |
77
-
|`format-date-time(dateTime, format)`| Returns dateTime as a string formatted as defined by <code>format</code>. Common formats include: <ul><li><code>%H</code>: 0-padded hour (24-hr time)</li><li><code>%h</code>: hour (24-hr time)</li><li><code>%M</code>: 0-padded minute</li><li><code>%S</code>: 0-padded second</li><li><code>%3</code>: 0-padded millisecond ticks</li></ul> |
75
+
|`format-date(date, format)`| Returns date as a string formatted as defined by <code>format</code>. Common formats include: <ul><li><code>%Y</code>: 4-digit year</li><li><code>%y</code>: 2-digit year</li><li><code>%m</code>: 0-padded month</li><li><code>%n</code>: numeric month</li><li><code>%b</code>: short text month (Jan, Feb, Mar…)</li><li><code>%d</code>: 0-padded day of month</li><li><code>%e</code>: day of month</li><li><code>%a</code>: short text day (Sun, Mon, Tue…).</li></ul> |
76
+
|`format-date-time(dateTime, format)`| Returns dateTime as a string formatted as defined by <code>format</code>. Common formats include: <ul><li><code>%H</code>: 0-padded hour (24-hr time)</li><li><code>%h</code>: hour (24-hr time)</li><li><code>%M</code>: 0-padded minute</li><li><code>%S</code>: 0-padded second</li><li><code>%3</code>: 0-padded millisecond ticks.</li></ul> |
0 commit comments