String Concatenation
Bindings can be used to join or concatenate two field values together. When writing String Concatenation statements you must be very careful about the use of the single quote character and the "+" character. Any values that are not wildcards must be wrapped in the single quotes and joined together with wildcards using the "+" character.
For example:
'Your full name is ' + [first name] + ' ' + [last name]
If you look carefully at this statement you'll see we are outputting a static text string 'Your full name is' and then inserting a wildcard (using the "+" character), then adding a space (again using the "+" character) and the final wildcard. If we were to add another static string to this output we would insert another "+" character and then open the next string using a single quote.
String Concatenation can be used to bind field values, output values in a Free Text Heading (using the Binding Property) and can also be used in conditional statements.
Any single quote character in your output string needs to be preceded with a "\" escape character as this example shows:
'We\'re all going to the event on ' + [selected day] + ' night.'
Using WildCards in Headings and Labels
If you are using the Free Text Heading Element or the Label element, you can use wildcards in the Text property of these fields without writing values and manually building the strings as shown here. When you use the Text property you can simply include wildcards anywhere in the text and they will be replaced with the field values. This works well when you want to, for example, show everything entered on the form. You could simply edit the Text property of a Free Text Header or Label and enter:
Please Review the following Selections:
Name: [first name] [last name] Age: [age] Address: [address] Event Selected: [event]
This is an easier way to output form field values when using a Free Text Heading or Label element. For other field types however you need to use the Bind Editor and the String Concatenation method described above. Also note, that if you need to use any conditional logic, you will also need to use the Binding method instead of the Text method.
0 Comments