Combining text and data in forms.
Sometimes you want to combine data and text into a sentence or phrase.
If the combination you are looking for is complex or conditional, you may find it easier to use the concat() function in a Calculated Value.
For additional information. see:
The concat() function combines a series of arguments separated by commas into a single string of text. An argument can be a text set off by single quotes or a value from another field. You can use this function to create short statements, or whole paragraphs.
The general format for the function is:
concat(argument, argument, argument, ... )
You have a form where the submitter can claim zero to 3 hours for standing by at the site of an event, in half-hour increments. The hourly rate they can claim is determined elsewhere in the form. You want to be able to produce a statement on the PDF output to describe the number of hours and the rate they are claiming.
To do this, you'll want:
Consider making the control $standbyStatement visible when using a test layer to make it easier to see and confirm that the statement is compiling correctly.
The formula for this could be:
if (string($standbyClaim) > '0') then
concat(
'Standby charge (',
string($standbyClaim),
' hours x $',
string($hourlyRate),
'/hr)'
)
else 'Standby charge (none)'
This conditional formula can produce 2 statements:
This allows us to confirm in the PDF that no claim was made if there wasn't one, rather than just leaving the statement blank.