Skip to content
Educora
Beginner16 min3 / 14

Metadata objects: constants, catalogs, documents, enumerations

Meet the building blocks of a configuration: constants, hierarchical catalogs, documents with tabular sections, enumerations, reports, data processors, common modules and roles. Learn the difference between a reference and an object.

Check yourself
In this lesson you will learn
  • Choose the right metadata object for a task
  • Recognise the standard attributes and tabular sections of catalogs and documents
  • Create a catalog item and a document in code and tell a reference from an object

In ordinary programming you create database tables, forms and menus by hand. In 1C you simply describe a metadata object — for example “Products catalog, attributes: Price, Unit” — and the platform builds the table, the list and item forms and the commands by itself. A configuration is assembled from such ready-made building blocks.

Constants and catalogs

A constant (Константа) stores a single value for the whole base: the company name, the main currency, whether VAT is used. A catalog (Справочник) is a list of items of the same kind: products, counterparties, employees, warehouses. Every catalog has standard attributes: Код (Code), Наименование (Description), ПометкаУдаления (DeletionMark) and Ссылка (Ref).

  • Hierarchy: a catalog can be split into groups (Иерархия групп и элементов), which adds the Родитель (Parent) and ЭтоГруппа (IsFolder) attributes. For example “Drinks → Tea”.
  • Owner (Владелец): one catalog can be subordinate to another, for example contracts belong to a counterparty.
  • Attributes and tabular sections: your own fields (Price, Unit) and lists of rows (for example a product's barcodes).
  • Predefined items are created in the Configurator and referred to by name in code: Справочники.Склады.Основной.
Definition
Reference and object

A reference (Ссылка) is a lightweight “address” of a record in the base: it is stored in attributes and compared, but you cannot change data through it. An object (СправочникОбъект) is a full copy of the record loaded into memory: you change it and save it with Записать() (Write).

1C
// Новый элемент справочника
НовыйТовар = Справочники.Товары.СоздатьЭлемент();
НовыйТовар.Наименование = "Çay 100 q";
НовыйТовар.Цена = 3.5;
НовыйТовар.Записать();

// Поиск и изменение существующего элемента
ТоварСсылка = Справочники.Товары.НайтиПоНаименованию("Çay 100 q");
Если Не ТоварСсылка.Пустая() Тогда
    ТоварОбъект = ТоварСсылка.ПолучитьОбъект();
    ТоварОбъект.Цена = 4;
    ТоварОбъект.Записать();
КонецЕсли;

// Константа
Валюта = Константы.ОсновнаяВалюта.Получить();
Manager (Справочники.Товары) → object → Записать(). In English syntax: Catalogs, CreateItem(), FindByDescription(), GetObject(), Write().

Documents

A document (Документ) records a business transaction that happens at a point in time: goods received, a sale, a payment. Its standard attributes are Номер (Number), Дата (Date), Проведен (Posted) and ПометкаУдаления. Numbers are assigned automatically and can, for example, restart every year. The document's key ability is posting (проведение): a posted document creates records in registers — we will study this in a separate lesson.

  1. 1
    Add a document

    Документы → Добавить, name: ПриходТовара (goods receipt). The synonym becomes Приход товара automatically. Tick the Склад subsystem.

  2. 2
    Create a tabular section

    On the Данные tab: Табличные части → Товары, columns: Товар (type СправочникСсылка.Товары), Количество, Цена, Сумма (Число).

  3. 3
    Check it

    Press F5, create a new document in the Склад section and add a few rows to the tabular section. The platform built the form automatically — you did not draw any form.

1C
Приход = Документы.ПриходТовара.СоздатьДокумент();
Приход.Дата = ТекущаяДатаСеанса();

НоваяСтрока = Приход.Товары.Добавить();
НоваяСтрока.Товар = Справочники.Товары.НайтиПоНаименованию("Çay 100 q");
НоваяСтрока.Количество = 10;
НоваяСтрока.Цена = 4;
НоваяСтрока.Сумма = НоваяСтрока.Количество * НоваяСтрока.Цена;

Приход.Записать();  // номер присвоится автоматически
Creating a document in code. Such code runs on the server (for example in a common module with the Сервер flag).

Enumerations and other objects

An enumeration (Перечисление, Enum) is a fixed list whose values only the developer defines: payment types (cash, card), order statuses. In code: Перечисления.ВидыОплаты.Наличные. Users cannot add new values — that is the key difference from a catalog.

ObjectPurposeExample
Регистры сведений / накопленияaccumulated or time-dependent datastock balances, prices
Отчетыanalysing and printing dataa sales report
Обработкиservice operationsbulk price change
Общие модулиreusable codetax calculation functions
Ролиaccess rightsa “Storekeeper” sees only warehouse documents
Подсистемыinterface sectionsWarehouse, Sales, Accounting

Key points

  • You describe a metadata object — the platform creates the table, forms and commands itself.
  • Catalogs are for lists (Код, Наименование, hierarchy); documents are for time-stamped transactions (Номер, Дата, posting).
  • A reference is read-only; to change data you need ПолучитьОбъект() and Записать().
  • Only the developer defines the values of an enumeration.
  • Names are written in CamelCase without spaces; users see the synonym.

Check yourself

10 questions. Every correct answer earns XP.

1 / 10
Which object best stores the company's main currency?