Hi, is it possible to add custom function and use it in the JSON. There are custom functions for expressions but is it possible to use them in other properties e.g. title, description, etc?
Hi, is it possible to add custom function and use it in the JSON. There are custom functions for expressions but is it possible to use them in other properties e.g. title, description, etc?
Hello Marian,
It is possible to use functions in properties of the expression
/condition
type. Unfortunately, titles and descriptions cannot directly embed functions. However, they can accept placeholders which represent other question or calculated field values. If you wish to use a function in a question's title, you can create a calculated field, include your custom question into its expression
and use the calculated field in a question title. Consider this example:
JSON{
"logoPosition": "right",
"pages": [
{
"name": "page1",
"elements": [
{
"type": "text",
"name": "question1",
"title": "Month: {cfMonth}"
}
]
}
],
"calculatedValues": [
{
"name": "cfMonth",
"expression": "month(today())"
}
]
}
Please let me know if you have any further questions.
It seems like calculatedValues are calculated only once, and not dynamic. And also I would like to pass params to it like {question1}.