37.5.2. Editing a template


<< Prev   Next >>

To edit an existing template file, use the Actions ‑ Change item. The template editing window containing templates located in the file will be displayed.

Fig. 779. Template editor

In the Name attribute, the template name is displayed as it is shown in the list of templates. In the Automatically replace string attribute, the string sequence is specified, after typing it, Designer allows you to replace it with a template. Replacement is initiated by pressing the Spacebar or Enter key.

Also, when a string is typed, a tooltip containing template text is displayed on the screen as shown on the figure below.

Fig. 780. Using templates

The template editing window contains a tools panel that can be used to create template groups and separate templates, delete unwanted templates and arrange the list. The tree of templates is located in the left part of the window. In the right part, the template group name and the template itself are edited.

For convenience, templates can be grouped into folders. To create a group, use the Add folder command from the context menu or press the appropriate button on the tools panel. Enter a group name in the Name attribute.

To create a template, select a group where it will be located and use the Add command from the context menu or press the appropriate button on the tools panel. Specify the template name in the Name attribute (this name is used to select a template for inserting into edited text). In the Automatically replace string field, you need to specify the initial part of the string and when it is typed, it will be replaced with template text in a text document window (if automatic substitution is on). To use automatic substitution, press Enter or Spacebar key, after entering a sequence of characters. Use the Template text multiline field to enter text that will replace the text specified in the Automatically replace string field or to be saved in document text when a template is selected.

Select the Include in context menu check box to make a template available for interactive selection.

A template for insertion in text (module) can be selected from the list of templates in the context menu. Templates are placed in the list if the Include in context menu check box is selected.

37.5.2.1. Template controls

Custom query

Description:

Is used to enter any text. When using this template, a dialog box for inputting context-dependent template part is displayed.

Syntax:

<?"Tooltip">

Parameters:

<Tooltip>

Explanatory label text.

Cursor positioning

Description:

The construct is used to position the cursor to the indicated location after inserting template text.

Syntax:

<?>

Specific Query

Description:

The construct is used to enter configuration objects, predefined items, and other data.

Syntax:

<?"Tooltip",<Keyword>[,<Parameter1>[,<Parameter2>...]]

Parameters:

<Tooltip>

Explanatory text in the entry query.

<Keyword>

Type of query.

<Parameter1>...

Query parameters.

Descriptions of specific queries are listed in the following table:

Russian

option

English

option

Description

BusinessProcess

BusinessProcess

Selecting a business process type

OptionChoice <Tooltip 1>, <String to insert 1>, … , <Tooltip N>, <String to insert N>

OptionChoice <Tooltip 1>, <String to insert 1>, … , <Tooltip N>, <String to insert N>

When using this template, a list of strings for selection is displayed.

Each string in the list consists of a tooltip and insertion text.

Example:

"Tooltip 1" ‑ parameter describing the text of the first string in the list;

"String to insert 1" ‑ parameter or text that will be inserted with selecting the first string

TypeChoice

TypeChoice

Type selection

Document

Document

Document type selection

DocumentJournal

DocumentJournal

Document journal type selection

Task

Task

Task type selection

EnumerationValue

EnumValue

Enumeration value selection

UserName

UserName

Username entry

TypeDescriptionConstructor

TypeDescriptionConstructor

Type description wizard

UserFullName

UserFullName

Full username entry

ConfigurationStorageUserName

ConfigurationStorageUserName

Entry of full configuration repository username

Constant

Constant

Constant selection

FilterCriterion

FilterCriterion

Filter criterion selection

Data Processor

DataProcessor

Data processor selection

Report

Report

Report selection

Recalculation

Recalculation

Recalculation selection

Enum

Enum

Enumeration selection

ChartOfCalculationTypes

ChartOfCalculationTypes

Chart of calculation types selection

ChartOfCharacteristicTypes

ChartOfCharacteristicTypes

Chart of characteristic types selection

ExchangePlan

ExchangePlan

Exchange plan selection

ChartOfAccounts

ChartOfAccounts

Chart of accounts selection

ChartOfCalculationTypesPredefinedData

ChartOfCalculationTypesPredefinedData

Selection of predefined data for a chart of calculation types. First, a chart of calculation types is selected and then predefined data value

ChartOfCharacteristicTypesPredefinedData

ChartOfCharacteristicTypesPredefinedData

Selection of predefined data for a chart of characteristic types. First, a chart of characteristic types is selected and then predefined data value

ChartOfAccountsPredefinedData

ChartOfAccountsPredefinedData

Selection of predefined data for a chart of accounts. First, a chart of accounts is selected and then predefined data value

MetadataObject

MDObjectsSubset

Metadata objects selection. When creating a template, a dialog box opens where you need to select types of metadata objects. When selecting a template, a selection dialog box is displayed, containing all metadata objects of the specified types

Sequence

Seq

Sequence selection

AccountingRegister

AccountingRegister

Accounting register selection

AccumulationRegister

AccumulationRegister

Accumulation register selection

CalculationRegister

CalculationRegister

Calculation register selection

InformationRegister

InformationRegister

Information register selection

Catalog

Catalog

Catalog selection

CatalogPredefinedData

CatalogPredefinedData

Selection of predefined data from the catalog. First, a catalog is selected and then the predefined data value

QueryText

QueryText

The query text is entered using the query wizard

DateTime, <Format string>

DateTime,
<Format string>

Entry of the current date in the format specified in the <Format string> parameter

FormatString

FormatString

The format string text is entered using the format string wizard

37.5.2.2. Template text editor

Structurally, a template can consist of a static (unchangeable) part and a dynamic part which content in context-dependent and cannot be specified in advance. For example, the If operator of the 1C:Enterprise language has the following structure:

If<?"Condition 1"> Then
ElseIf <?"Condition 2"> Then
EndIf;
<?"Condition...">

These are context-dependent template parts.

For versatility of template use, the control directive insertion mechanism is applied. Control directives are inserted into the template text. Control directives are character sequences that initiate execution of some actions when inserting the replacing template text. For example, control directives allow you to request information from the user and to add this information to the text to be inserted.

Control directives can be inserted into the template manually, or interactively, using a specific query.

Fig. 781. Control directive insertion

You need to position the cursor in the template area with a variable part and click <->Insert... The Insert control directive dialog box is displayed.

In the Tooltip attribute, user specifies a text line displayed as an explanation to an action performed when a context-dependent part of template is requested. Since a template can contain several control directives that can be entered in a sequence, this text explains the performed actions and the location of the variable part.

Radio button group can be used to select the type of a control directive for insertion into the template.

A custom query is used to enter any text. A control directive of <?"Tooltip text"> type will appear in the template text.

The Custom query control directive is used as follows. If the text to be replaced contains a <?"Tooltip text"> directive, a request with tooltip text and text input field is displayed before the replacement text is inserted. In the input field, you can specify the text to be inserted in the replacement text instead of <?"Tooltip text"> directive. There could be several Custom query type directives in the replacement text and some directives can have the same tooltip text. When inserting a replacement text, a specific text request is provided for each directive. There will be one common query for all identical directives and the text entered in the query will replace all identical directives.

Specific query is used to select configuration objects. To place a type selection of a configuration object into the control directive template using the Insert control directive window, you need to enter the query name in the Tooltip field and select a directive from the list (selection of configuration object, predefined configuration object item or an appropriate directive), for example, Catalog.

Fig. 782. Specific query

When using this template, a list of possible configuration objects is displayed. The name of a selected object is placed instead of the entered text. Position of the selected string is stored and the list will be positioned on this string when selecting this template again.

The possible values of a specific query include the switch. We will additionally describe it. When a template with this type of a query is formed and OK is clicked, the window of possible values formation list is displayed.

Fig. 783. Data for selection

The Tooltip column is used to enter text that will be displayed in the selection list when this template is used. The Insertion string column is used to enter text that will be placed into the text document.

The list can only be edited in the template text. When re-calling the insert directive, a new directive will be added.

After clicking OK, a control directive is inserted into the template text.

Fig. 784. Template with a control directive

In the template tree (or during automatic substitution), select this template.

Fig. 785. Context menu

In this case, a catalog type selection query is displayed.

Нет

Fig. 786. Enumeration selection

As a result of a selection, the following text is generated:

PredefinedValue("Enumeration.ProductTypes.Product")

Position cursor. Is used to position the cursor in the indicated location after inserting template text. The <?> type directive is inserted in the replacement template text. It defines where the cursor must be positioned when entering the replacement text. If there are several directives of this type in the replacement text, the cursor is positioned in the first in order <?> directive place.

When writing a template text, the use of multiple control directives as well as the use of existing templates is allowed.

<< Prev   Next >>

Icon/Social/001 Icon/Social/006 Icon/Social/005 Icon/Social/004 Icon/Social/002