Question titles can contain variables, in the form of [variableName] (aka DataPiping). That variable must have previously been set in the persistent storage inside an ExecTag.
<exec> p.school = q1.valName </exec> <radio where="survey"> <title>You selected [school] as your college/university. Is this correct?</title> <row label="a1">Yes</row> <row label="a2">No</row> </radio>
1: Simple Piping
We also support piping of text answers directly, currently only for simple questions, e.g.:
<radio label='q1' title='Favourite fruit'> <row label='r1'>Banana</row> <row label='r2'>Pinepapple</row> <row label='r3' open='1'>Other, specify</row> </radio> <suspend/> <html> I see you like [pipe: q1]!</html>
So the simple pipe looks like
[pipe: QLABEL] and pipes the result of a 1D radio, 1D Checkbox, 0D select, 0D Text or Textarea question. If the Radio has an open=1 option selected, that other text is piped in. Any displayed text is escaped.
For checkbox questions, if you specify
[pipe: q3] for q3 question which has multiple rows or columns checked, the results are joined together (to form text like "red, green and blue"). These separators are language dependent. You can use the pipeMultiple attribute on the <checkbox> tag to specify text of a different row should be used when multiple rows have been checked.
2: Transforming Piped Results
You can put in one or more of these verbs inside the pipe: after the label to modify it: lower upper title capitalize. For example, using
[pipe: q1 lower] turns the piped text into lowercase before displaying it. Given input of "hello, World", the transformations will have the following result:
- upper: HELLO, WORLD
- lower: hello, world
- title: Hello, World (start of every word is capitalized)
- capitalize: Hello, world (only beginning of input is capitalized)