CREATING QUERIES WITH APPLICATION FORM OBJECTS "Handbook " in "1C : Enterprise 8.2"

 

Zharova Botagoz , 4th year student of the specialty " 5V070300 - Information Systems"

Sh . A.Baitursynov

Irina Morozova , Senior Lecturer , Department of Information Systems

KSU . A.Baitursynov

 

  Request - a special object in the " 1C: Enterprise 8.2 ", which is used to generate and execute queries to the database tables in the system. To make the request to make the query text that describes what the table will be used as a data source query, which you need to select the field, which to apply sorting and grouping, etc. For example, a query can be made ​​easily calculate the amounts of specific counterparties. The system "1C: Enterprise 8.2 " has a special query language, the purpose of which is to formulate the system requirements on what you need to select from the available data.

Query Language 1C is a completely separate language, which allows you to specify what data we need to get from the database. He is also bilingual; it is possible to write in Russian or in English. It is extremely similar to the query language SQL.

1C requests are:

• « automatic » Requests 1C are generated automatically by the system. You have created a form of a list of documents. Added column. This means that the opening of this form in plant will be requested by the request and data on this column.

• « Semi ' requests 1C is a set of methods (functions) in the language 1C, with reference to which there is a query to the database. For example, the Get Object ( )

• « Hand ' requests 1C (specially written by the programmer as a request), you can write a query 1C yourself in the code and execute it.

Once the text is ready to request 1C - it needs to perform. To do this, there is an object in the code 1C query (). Here's an example:

Запрос = Новый Запрос();

Запрос. Текст = "ВЫБРАТЬ

| Номенклатура. Ссылка

|ИЗ |

Справочник. Номенклатура КАК Номенклатура

|ГДЕ |

 Номенклатура. Услуга";

Выборка = Запрос. Выполнить().Выбрать();

Пока Выборка. Следующий() Цикл

Сообщить (Выборка. Ссылка);

КонецЦикла;

 

As you can see in this example - after the query 1C comes to us the result and we have to handle it. Result - is one or more lines of the table (in the special form).

The result can be uploaded to a regular table:

 

Выборка = Запрос. Выполнить().Выгрузить();

//Результат – таблица значений

Или просто обойти по строчкам.

 

Выборка = Запрос. Выполнить().Выбрать(); Пока Выборка. Следующий() Цикл //Что-то делаем с результатами запроса КонецЦикла;

 

Not to write the query text hands - there is the Query 1C. Simply right-click anywhere in the module, and  select Query Design. Select the Query 1C desired table on the left and drag to the right (Figure 1).

 

 

 

 

 

 

 

 

 


Figure 1. The Query Designer

 

Select the Query Table 1C of the fields you want and drag to the right. If you do not want to just select the field, and apply what or the sum function - after dragging click on the field twice with the mouse. Grouping tab then need to select (drag) to group the fields (Figure 2).

 

 

 

 

 

 

 

 

 


                                  

Figure 2. Grouping

 

On the Conditions tab in the Query 1C you can select the desired selections in the same way (by dragging the fields by which you will make the selection) (Figure 3). Do not forget to select the right condition.

 

 

 

 

 

 

 

 

 

 

 

 

 

 


Figure 3. Bookmark the "Terms"

 

   The tab order - specifies sorting. Summary tab - summing up. Using the Query Designer 1C you can learn any existing request.

   To do this, right-click on the text of an existing query and select query builder also 1C - and the request will be opened in the Query 1C.