This topic describes the implementation of fields in the context of a Snap reporting application.
The Fields are defined as a set of codes that instructs the program to insert text and graphics into a document automatically. It means that Snap fields serve as placeholders for dynamic data.The data inserted into a document when the application processes a field’s codes is called the field result for that field.
To add dynamic content from a connected data source to a document, drop merge or data fields onto the appropriate document areas, and create tabular or mail merge report layouts. After executing a command in a Snap application (e.g., after inserting a page number or bar code), the corresponding field codes are automatically added to the document markup.
To display the codes of all document fields, click Show All Field Codes in the View toolbar tab.

Field codes appear between curly braces ( { } ).

As you can see, the field code consists of the Field name which points what specified dynamic data should be inserted,the table name the data should be taken from and the switch - a markup element specifying an optional setting available for a particular field.
Actual data values are supplied to the fields after setting a document for publishing (e.g., when printing or exporting a report).To toggle between the field code and the merge results of document fields (i.e., the corresponding data values), press Alt+F9.

Fields are divided into two types, based on their intended use.
Snap Fields
Snap fields are used as placeholders for data-bound content.
The following table lists the field codes that are showcased by Snap to insert dynamic data into a document.
Field Name
| Functionality
| Switches
|
---|
SNLIST
| Inserts the specified list.
|
- \name - specifies the name of a Snap list.
- \t - specifies the template used to display every data row of a data source.
- \listheader - specifies the content of the list header.
- \listfooter - specifies the content of the list footer.
- \erl - specifies the maximum number of data rows to include in the document during the design session. The default is 20.
- \separator - specifies the separator to be inserted between data rows of a Snap list.
- \tga, \tgb, \tgc … - specify the content of the Snap list’s group headers and group footers.
|
SNTEXT
| Inserts the specified text.
|
|
SNCHECKBOX
| Inserts the specified check box.
|
|
SNCHART
| Inserts the specified chart.
| The switches of this Snap field may contain complex/binary data, and are not intended to be manually inserted into markup.
|
SNBARCODE
| Inserts the specified bar code.
| The switches of this Snap field may contain complex/binary data, and are not intended to be manually inserted into markup.
|
SNIMAGE
| Inserts an image with a specified height and width.
|
|
SNINDEX
| Inserts the specified row index.
|
|
SNSPARKLINE
| Inserts the specified sparkline.
|
- \dsn - specifies the data member name for hierarchical data sources.
- \w - specifies the width of a sparkline.
- \h - specifies the height of a sparkline.
- \vt - specifies the view type of a sparkline.
- \hmxp - specifies whether or not to highlight the sparkline point with the highest value among all points.
- \hmnp - specifies whether or not to highlight the sparkline point with the lowest value among all points.
- \hsp - specifies whether or not to highlight the start point of a sparkline.
- \hep - specifies whether or not to highlight the end point of a sparkline.
- \cl - specifies the color used to draw a sparkline.
- \mxpcl - specifies the color used to draw the sparkline point with the highest value among all data points.
- \mnpcl - specifies the color used to draw the sparkline point with the lowest value among all data points.
- \spcl - specifies the color used to draw the start point of a sparkline.
- \epcl - specifies the color used to draw the end point of a sparkline.
- \npcl - specifies the color used to draw sparkline points that have negative values.
- \lnw - specifies the width of the chart line for the Line and Area sparkline view types.
- \hnp - specifies whether or not to highlight all negative points in the Line, Area and Bar sparkline view types.
- \sm - specifies whether or not to show point markers in the Line and Area sparkline view types.
- \msz - specifies the size of markers for data points in the Line and Area sparkline view types.
- \mxpmzs - specifies the marker size of the data point with the highest value among all data points in the Line and Area sparkline view types.
- \mnpmsz - specifies the marker size of the data point with the lowest value among all data points in the Line and Area sparkline view types.
- \spmsz - specifies the size of the start point’s marker in the Line and Area sparkline view types.
- \epmsz - specifies the size of the end point’s marker in the Line and Area sparkline view types.
- \npmsz - specifies the marker size of all data points that have negative values in the Line and Area sparkline view types.
- \mcl - specifies the color of line markers for the Line and Area sparkline view types.
- \ao - specifies the opacity (0-255) of the area fill color for the Area sparkline view type.
- \bd - specifies the distance between two bars of a sparkline of the Bar or WinLoss view type.
- \eef - specifies whether or not to display a custom text instead of a blank space if the bound data field contains no values.
- \ef - used with the \eef switch. Specifies the text to show in a document instead of a blank space if the bound data field contains no values. The default string is <<IncorrectData>>.
|
SNHYPERLINK
| Inserts the specified hyperlink.
|
- \d - specifies the data member containing the hyperlink display text.
- \o - specifies the text of the tooltip that appears when the mouse cursor points to a hyperlink.
- \t - specifies the target frame of a link.
- \eef - specifies whether or not to display a custom text instead of a blank space if a hyperlink is not found or does not exist.
- \ef - used with the \eef switch. Specifies the text to show in a document instead of a blank space if a hyperlink is not found or does not exist. The default string is <<No Data>>.
|
Document Fields
Document fields are used as placeholders for other types of dynamically generated content such as current date and time, a page number, or a table of contents.
Snap inherits most of the field codes described in this section from its ancestor RichEditControl, to ensure that they are supported in Snap documents.
The following table describes the most commonly used fields.
Field Name
| Functionality
| Switches
|
---|
CREATEDATE
| Inserts the current date and time. After a mail merge, the field is replaced with the date and time of the mail merge operation.
| None
|
DATE
| Inserts the current date and time.
| None
|
TIME
| Inserts the current time.
| None
|
HYPERLINK
| Enables you to navigate to another location or to a bookmark.
| None
|
IF
| Compares two values, and inserts text according to the results of the comparison.
| None
|
INCLUDEPICTURE
| Inserts the specified picture.
|
\d - this switch prevents you from storing the image in a document file.
For example, the {INCLUDEPICTURE “C:\TMP\Mypicture.png” \d} field retains a link to the picture, but the picture itself is not included in the saved document.
|
NUMPAGES
| Inserts the total number of pages.
| None
|
PAGE
| Inserts the number of the page containing the field.
| None
|
SEQ
| Provides sequential numbering in the document.
|
- \c - repeats the closest preceding sequence number.
- \h - hides the field result.
- \n - inserts the next sequence number for the specified item. This mode is used by default.
- \r - resets the sequence number to the specified integer number.
|
TC
| Defines entries for the table of contents.
|
- \f - specifies the type of items collected in a particular content list. Use a unique type identifier for each type of list. This switch is required for including an entry into the corresponding table of contents.
- \l - the level of the TC entry. If no level is specified, level 1 is used.
|
TOC
| Builds a table of contents. Without switches, the table of contents is built upon styles with set outline levels. Outline levels assigned to individual paragraphs are disregarded unless the \u switch is specified.
|
- \b - only includes entries from the portion of the document marked by the bookmark named by text specified in a field argument.
- \h - inserts table of contents entries as hyperlinks.
- \n - omits page numbers from the table of contents. Page numbers are omitted from all levels unless a range of entry levels is specified. For example, { TOC \n 1-1 } omits page numbers from level 1.
- \u - uses the applied paragraph outline level.
- \o - builds a table of contents from paragraphs with specified outline levels. For example, { TOC \o “1-3” } only lists paragraphs with outline levels 1 through 3.
- \t - builds a table of contents from paragraphs formatted with specified styles. For example, {TOC \t”Title,1,subtitle,2,customtitle,3”} builds a table of contents from paragraphs formatted with the styles “Title”, “subtitle” and “customtitle”. The number after each style name indicates the entry level corresponding to that style.
- \c - builds a table of contents from items that are numbered by an SEQ field. The sequence identifier designated by text in this switch’s field-argument shall match the identifier in the corresponding SEQ field.
- \s - for entries numbered with an SEQ field, adds a prefix to the page number. The prefix depends on the type of entry.
- \d - when used with \s, defines the separator between sequence and page numbers. The default separator is a hyphen (-).
- \f - builds a table of contents from TC fields. The TC field identifier must match the text exactly in this switch’s field-argument.
- \l - used with the \f key. Includes TC fields that assign entries to one of the specified levels.
|
See Also
See Also