webmerge
FOLDER
,
TEMPLATE
,
RESULT

The webmerge statement merges an external HTML template file with fields and variables from the current record.


Parameters

This statement has three parameters:

folder – folder containing the template (or "" if template is in the same folder as the database, or if template name contains full path). When using Panorama X, this parameter is usually left blank and the path is placed in the second parameter.

template – HTML template for form. This can either be the name (or path+name) of a file containing the template, or the template itself. If the latter, the HTML code must include an HTML tag that begins with </, for example </body>. (Usually your HTML text will naturally contain lots of these tags.)

result – field or variable where the final result will be place. If empty or missing, the final result will be placed in the cgiHTML global variable.


Description

This statement merges an external HTML template file with fields and variables from the current record. (Note: This statement does not merge data into <input> tags, if you need to do that, use the webformmerge statement, which works very similarly to this statement.)

You can embed Panorama formulas into the template by enclosing them with ~{ and }~. These formulas can include fields and/or variables, including local variables. This example will display an address label based on data in the current record of the database. There are three formulas embedded into this template.

let labelTemplate = |||<body>
~{First+" "+Last}~<br>
~{Address}~<br>
~{upperword(City)+", "+upper(State)+" "+Zip}~
</body>|||
webmerge "",labelTemplate,cgiHTML

If any of the formulas contain an error (for example a field or variable that does not exist), the webmerge statement will return an error. You can trap the error with if error (see [Error Handling]), but it’s a good idea to eliminate all possible formula errors in your template before putting your server application into production.


See Also


History

VersionStatusNotes
10.2UpdatedCarried over from Panorama 6.0, but formula errors now cause a Panorama error to occur.