For created templates, you need to set a connection between the template field and a data source field, which is called mapping. Mapping will be used to fill in PDF fields with table or view fields data when an app user downloads a file. 

To map a template with table or view:

  1. From the Data source field, select the table or the view to which you want to map this template.
  2. Select the Click to map link for any field on the right panel or click any field in the PDF file preview to map the PDF field elements.

    Note: Password data type is not applicable to mapping fields.

  3. From the Mapping type dropdown, select the mapping you want to configure:
IF...THEN...
If you want to map the template field with a table or view field, 

...perform the following actions: 

  1. Select Data source field in the Mapping type. 
  2. From the Data source field dropdown, select a table field to be mapped with a PDF field.
  3. Optional: If you want to divide the value into multiple template fields, configure your range of used characters in Use characters from.                       
    Example: A US Social Security Number (SSN) has 9 digits, which are usually stored in one table field, but can be divided into three PDF template fields. To reflect that, map the first template field to characters 1-3, the second field to characters 4-6, and so on.  
  4. Optional: You can use a value defined in the Display Valueof the table relationship settings. To do so, check Use display value. This setting is only available if the selected data source field has been defined as a related field in the Relationship Settings with the display value preconfigured.  
  5. For Checkbox, in Checkbox selected if value, you can select the condition on which it is selected on the generated PDF.  
  6. For Radio button, Dropdown or Listbox, you can see the list of available values. Additionally, for Dropdown field you can use a different value if other (custom) values are allowed. 
  7. Click Next to map another field or Save to save the template.

If you want to: 

  • map one template field with several data source fields through parameters
    or 
  • apply an exact value to a text field, 

...perform the following actions: 

  1. Select Custom value in the Mapping type. 
  2. In the Custom value field, enter the parameters. You can insert system parameters or a data source field with the Insert parameter link or type them manually.  
  3. Optional:  For data source field parameters, you can use a value defined in theDisplay Valueof the table relationship settings. To do so, check Use display value. This setting is only available if the selected data source field has been defined as a related field in the Relationship Settings with the display value preconfigured.  
  4. Click Next to map another field or Save to save the template. 

Example: You can map the template address field with such table fields as ZIP code, city, and street. Custom value is only available for the Text field type. 

If you want to remove existing mapping, ...select None. 

Formatting a specific field 

It is possible to customize the formatting of a specific field value for Text, Listbox, Radio button or Dropdown template field type. To do that, click Edit in the Formatting section File options.   

In the Data format tab, for a Data source field mapping type, you can configure the display format and regional settings for textual, numeric, currency, and date/time values in your PDF document. For example, you can display a long date formatted for the Australia region.  

  • For Text field, you can format the values in a chosen format. 
  • For Listbox, Dropdown and Radio buttons, you can format the values from the table to match their format in the available values of a template field. For example, you can unify a value of a date/time table field as it is stored with time in a table field but it is created without time in the available values of a template field. 

Note:  Data format settings are applied upon PDF generation. If a user edits a value on a generated PDF, the source PDF data format settings are applied (and not data format settings from a template). 

It is also possible to apply regional formatting for the entire document on the template level. To learn more, see Regional formatting. 

In the Typographytab, for both mapping types, you can view and edit the font style used on the generated PDF file. The following attributes are adjustable: font family, font size, style, color, letter case, alignment and background color.Font size and font style can be changed only to the fonts predefined by Caspio. The following fonts are supported: Helvetica, Courier, TimesRoman, Symbol, ZapfDingbats.

Note: Due to PDF format limitations, background color may not display properly in Text fields with Comb property (division into single character segments).

Editing default value of a document template field 

The default value is set on the level of a PDF file used for template creation and it specifies the value of a particular field. Each time a template field remains empty (for example, because it hasn’t been mapped or its value is empty), it will be filled with a default value. For a Custom value, a default value will only appear when a parameter returns an empty value.  

You can edit default value on a template field:  

  • For Text field, you can write a value. 
  • For Checkbox, you can choose if it is cleared or selected. 
  • For Radio button, Dropdown or Listbox, you can select values from the list of available values.  Additionally, for Dropdown field, you can type a value if other (custom) values are allowed.  

Leaving field editable after PDF document is merged with data 

Sometimes you may not want to map all the fields in a template expecting, for instance, app users to enter the value or not having relevant data stored in the data source table. You may also want to map a field with a value expecting that it will be adjusted after a file is generated. In this case, select “Always allowed” or “Allowed if field is empty” from the Editing after PDF generation dropdown.