FEATURES BATCH REQUEST TO THE  "1C: ENTERPRISE 8.2"

 

Makhmetova Aigerim, 4th year student of the specialty "5B070300 - Information Systems"   

KSU A.Baitursynov

Irina Morozova, a senior lecturer in information systems KSU A.Baitursynov

 

The system 1C: Enterprise 8.2 from version 8.1.11, the notion of "Batch requests." At its core, packet queries provide a new approach to the formation of complex queries.

 In fact, query batch several requests can be described as interconnected using temporary tables, and not related. As a result, you can perform consistently and accept all requests as a result of either an array with the results of each query execution, or the result of the latter. For an array with the results of the query method is used " ВыполнитьПакет()" object request and to obtain the result of the last request " ВыполнитьЗапрос()".

The text of the query, the query packet are separated by "," (comma). The namespace of virtual tables in one batch request one.  Using the manager of temporary tables is not required, but it is possible if you want to pass a temporary table from one batch to another query.

 To create a batch request in the 1C: Enterprise 8.2 uses the proposed placement.

What are the advantages of this method? When the results of the query are put into a temporary table, they can be used multiple times. There is no need to carry out several times one and the same sub-request, and select the data from the finished table.

What are disadvantages of this method? When using temporary tables in the batch requests, the system generates a real database table. How bad is it? Spent the time to create the table, and after the execution of a request for its destruction.

 

We make a similar request for outgoing documents

ВЫБРАТЬ

             Номенклатура,

             Сумма(Количество) КАК Количество,

             Сумма(Сумма) КАК Сумма,

ПОМЕСТИТЬ ДокПриход

ИЗ

             Документ.ПоступлениеТоваровУслуг.Товары

СГРУППИРОВАТЬ ПО Номенклатура

;

ВЫБРАТЬ

             Номенклатура,

             Сумма(Количество) КАК Количество,

             Сумма(Сумма) КАК Сумма,

ПОМЕСТИТЬ ДокРасход

ИЗ

             Документ.РеализацияТоваровУслуг.Товары

СГРУППИРОВАТЬ ПО Номенклатура

;

ВЫБРАТЬ

*

ИЗ

             ДокПриход КАК ДокПриход

ПОЛНОЕ СОЕДИНЕНИЕ

             ДокРасход КАК ДокРасход

ПО 

             ДокПриход.Номенклатура = ДокРасход.Номенклатура

Now for a request for a more beautiful sight. Reflect the query, how much money and we had a number of pay-in, and what supplies.

ВЫБРАТЬ

     ДокПриход.Номенклатура,

     ДокРасход.Номенклатура,

     ДокПриход.Количество КАК КолПриход,

     ДокПриход.Сумма КАК СумПриход,

     ДокРасход.Количество КАК КолРасход,

     ДокРасход.Сумма КАК СумРасход

ИЗ

     ДокПриход КАК ДокПриход

ПОЛНОЕ СОЕДИНЕНИЕ

     ДокРасход КАК ДокРасход

ПО 

     ДокПриход.Номенклатура = ДокРасход.Номенклатура

 

Result:

Номенклатура

Номенклатура1

КолПриход

СумПриход

КолРасход

СумРасход

Бензин Аи-92

Бензин Аи-93

70,000

6 500,00

15,950

1 681,45

Бензин Аи-92

Бензин Аи-93

70,000

6 500,00

1,146

120,81

Скоросшиватель пластиковый

 

50,000

3 350,00

 

 

 

Модем ADSL ZyXEL

 

 

1,000

7 790,00

 

As can be seen from the result, we obtained data on income and expenditures. But we still have the problem of how to combine the two columns, "Номеклатура" and "Номенклатура1?" If you take the value of the column " Номеклатура ", then do not get the value from the last row, and if we take the value from column " Номеклатура1", then do not get the value from the third row. For this we use the function "ЕСТЬNULL." This can be written as follows:

ВЫБРАТЬ

     ЕСТЬNULL(ДокПриход.Номенклатура,ДокРасход.Номенклатура)

     КАК Номенклатура,

     ДокПриход.Количество КАК КолПриход,

     ДокПриход.Сумма КАК СумПриход,

     ДокРасход.Количество КАК КолРасход,

     ДокРасход.Сумма КАК СумРасход

ИЗ

     ДокПриход КАК ДокПриход

ПОЛНОЕ СОЕДИНЕНИЕ

     ДокРасход КАК ДокРасход

ПО 

     ДокПриход.Номенклатура = ДокРасход.Номенклатура

Result:

Номенклатура

КолПриход

СумПриход

КолРасход

СумРасход

Бензин Аи-92

70,000

6 500,00

15,950

1 681,45

Бензин Аи-93

70,000

6 500,00

1,146

120,81

Скоросшиватель пластиковый

50,000

3 350,00

0

0

Модем ADSL ZyXEL

0

0

1,000

7 790,00

 

Batch queries are very useful mechanism in terms of query writing and reading from the point of view of complex queries. Batch Queries logical complement the functionality of temporary tables and allow more flexibility in dealing with requests.