Pogues
Pogues copied to clipboard
VTL expression in Checkbox options
Hi 👋,
The VTL expression generated for checkbox options are badly formatted.
Label options are string, so they need to be encapsulated by quotes.
For example, this survey the checkbox is configured as follows
which generate this :
{
"componentType": "CheckboxOne",
"bindingDependencies": ["LOGAUT"],
"controls": [...],
"response": { "name": "LOGAUT" },
"hierarchy": {...},
"options": [
{ "label": { "type": "VTL|MD", "value": "OUI" }, "value": "1" },
{ "label": { "type": "VTL|MD", "value": "NON" }, "value": "2" }
],
...
},
As you can see, options label are not valid VTL expression, this should be generated like this
"options": [
{ "label": { "type": "VTL|MD", "value": "\"OUI\"" }, "value": "1" },
{ "label": { "type": "VTL|MD", "value": "\"NON\"" }, "value": "2" }
],
Est-ce que ça serait pas plutôt :
"options": [
{ "label": { "type": "MD", "value": "OUI" }, "value": "1" },
{ "label": { "type": "MD", "value": "NON" }, "value": "2" }
],
Que l'on attend ? Si on considère que le typage a été défini pour éviter d'éventuels traitements VTL inutile. Sur ce point, on a vraiment que du texte.
Les libellés peuvent être des formules
The VTL|MD
type is specifically designed for fields accepting both VTL expressions or Markdown text.
We can nudge users to always use double quotes for field values. Or indeed having an implicit mecanism that would add the missing ones ? Or the Pogues field raising an error when no double quotes are head and tail of the expression / text ?
For VTL, a string seems to be always with double quotes.
In lunatic the survey is in a json file, so the first double quotes are there to indicated that in the json format it's a string. In lunatic I get the string OUI
and then a I send it to VTL. Finanly VTL says to me : it's not a valid syntaxe because OUI does not exist in VTL (We would send to VTL "OUI"
).