- Create an empty infobase and open it in the Configurator
- Explain the difference between the main configuration and the database configuration
- Debug code with breakpoints, stepping and expression evaluation
The best way to learn programming is to build something right away. In this lesson you will create an empty base for a small shop, add a “Products” catalog to it, check it in user mode and debug your first code step by step. All you need is the 1C:Enterprise 8.3 platform (the training version is fine).
Creating an empty infobase
- 1Open the launcher
Start 1C:Enterprise. The window that opens shows the list of infobases. Click
Добавить…(Add). - 2Choose a new infobase
Choose
Создание новой информационной базы(create a new infobase), thenСоздание информационной базы без конфигурации…(without a configuration) — this gives you an empty configuration. - 3Name and location
Name the base (for example “Educora Shop”) and choose
На данном компьютере или на компьютере в локальной сети(on this computer or on the local network) — this is file mode. Then pick an empty folder. - 4Finish and open the Configurator
Keep the remaining settings and click
Готово(Finish). Select the new base in the list and clickКонфигуратор(Designer).
The metadata tree and the two configurations
The menu Конфигурация › Открыть конфигурацию (Configuration › Open configuration) opens the metadata tree. The root is the configuration name, with branches below: Общие (common objects: subsystems, common modules, roles…), Константы, Справочники (catalogs), Документы, Перечисления (enumerations), Отчеты, Обработки (data processors), registers and more. Every object has a property palette (Alt+Enter) and an editor window.
What you edit in the Configurator is the main configuration. Users work with the database configuration. Your changes reach the database only after Обновить конфигурацию базы данных (Update database configuration, F7).
First catalog: “Products”
- 1Create a subsystem
Right-click
Общие › Подсистемы→Добавить(Add). Name itСклад(Warehouse). A subsystem appears as a section in the user interface. - 2Add a catalog
Справочники→Добавить. Name:Товары(Products). On theПодсистемыtab tick theСкладsubsystem. - 3Add an attribute
On the
Данные(Data) tab addЦена(Price) toРеквизиты(attributes): typeЧисло(Number), length 15, precision 2. - 4Update the base and run it
Press F7: confirm the changes in the
Реорганизация информации(data restructuring) window withПринять(Accept). Then press F5 — 1C:Enterprise mode opens and the Products catalog appears in theСкладsection.
First code and debugging
Right-click the configuration root and choose Открыть модуль управляемого приложения (Open managed application module). Its event procedure ПриНачалеРаботыСистемы (OnStart) runs on the client as soon as the application opens. Type the code below and check the syntax with Ctrl+F7.
Процедура ПриНачалеРаботыСистемы()
Сумма = 0;
Для Н = 1 По 5 Цикл
Сумма = Сумма + Н; // поставь здесь точку останова (F9)
КонецЦикла;
Сообщить("Сумма: " + Сумма);
КонецПроцедурыСумма: 15
Сообщить() (Message) shows text in the messages window. 1 + 2 + 3 + 4 + 5 = 15.Now put a breakpoint on the line Сумма = Сумма + Н; with F9 and press F5. Execution stops on that line. Step through with F10, look at the value of Сумма or Н with Shift+F9, and open the watch panel (табло) with Ctrl+Alt+W — there variables refresh at every step.
Ctrl+-)F12Protect your work: backups
| File | What it contains | Where it is created |
|---|---|---|
.dt | the whole base: configuration + data | Администрирование › Выгрузить информационную базу |
.cf | the configuration only | Конфигурация › Сохранить конфигурацию в файл |
.cfu | a configuration update file | released by the vendor |
.epf / .erf | external data processor / external report | Файл › Новый… |
.cfe | a configuration extension | in the extension editor |
Key points
- An empty base is created with the option
Создание информационной базы без конфигурации…. - In the Configurator you edit the main configuration; users see the changes after F7.
- Subsystems are interface sections; include an object in a subsystem so it appears there.
- Debugging: F9 breakpoint, F5 start, F10/F11 step,
Shift+F9evaluate. - Backups: the whole base —
.dt, the configuration only —.cf.
Check yourself
10 questions. Every correct answer earns XP.