webmerge
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

- deletewebtemplate -- deletes the web template (a dictionary) associated with a form (if any).
- getwebtemplate -- retrieves the web template (a dictionary) associated with a form (if any).
- getwebtemplate( -- retrieves the web template (a dictionary) associated with a form (if any).
- getwebtemplatetext -- retrieves the text of the web template (a dictionary) associated with a form (if any).
- getwebtemplatetext( -- retrieves the text of the web template (a dictionary) associated with a form (if any).
- grabwebformitems -- grabs multiple web form items and stuffs the values into fields and/or variables.
- listwebtemplates -- retrieves a list of web templates in the specified database, if any.
- listwebtemplates( -- retrieves a list of web templates in the specified database, if any.
- makeformwebtemplate -- converts a Panorama form into the equivalent HTML/CSS.
- renderwebform -- renders a Panorama web form into HTML, merging data into the template as necessary.
- renderwebform( -- renders a Panorama web form into HTML, merging data into the template as necessary.
- retrywebform -- retries a web form that has missing or invalid data.
- savewebtemplate -- saves a web template (a dictionary) associated with a form.
- sethiddenwebformitem -- adds a hidden field to a form on a web page.
- webdatabasetoform -- fills in an HTML form with database field values.
- webfontsubstitutes -- generates an array of standard font substitutions for web browsers.
- webformallitems( -- returns a list of POST parameters passed from a form to the web server as a carriage return separated list.
- webformerrors( -- returns a list of errors that have been collected with the WebFormItemCheck statement.
- webformhiddenitems( -- returns a list of the hidden items in the web form submitted to this web procedure.
- webformitembang -- sets the text generated by the webformitembang( function.
- webformitemnames -- returns a list of POST parameters passed from a form to the web server as a carriage return separated list.
- webformitemnames( -- returns a list of POST parameters passed from a form to the web server as a carriage return separated list.
- webformitems( -- returns a list of POST parameters passed from a form to the web server, including both visible and invisible items (but excluding the special items Panorama generates for its own internal use).
- webformmerge -- fills in an HTML form with database values (fields and variables).
- webformrecordid -- adds a RECORD_ID hidden field to the HTML of a web form.
- webformselection -- selects data based on input from a web form. The web form must have fields that match the database fields.
- webformtodatabase -- updates the current database with information from the web form that was just submitted.
- webformvisibleitems( -- returns a list of the visible items in the web form submitted to this web procedure.
- webthisrecordkey -- makes a key for use with the WebURLSelect statement to specify the current record.

History

Version | Status | Notes
10.2 | Updated | Carried over from Panorama 6.0, but formula errors now cause a Panorama error to occur.