1C:Enterprise 8.3. Practical Developer’s Guide. Quick developer reference. Accumulation registers

Accumulation registers

1C:Enterprise script objects used for operations with accumulation registers

The following chart shows the interaction between 1C:Enterprise script objects used for operations with accumulation registers (fig. 29.19).

Quick developer reference / Accumulation registers / 1C:Enterprise script objects used for operations with accumulation registers
Fig. 29.19. 1C:Enterprise objects used for operations with accumulation registers

Note. The yellow box indicates the data manipulation objects. The object method from which the arrow originates is marked with the respective number in the listing, while the target object of the arrow is the type of returned object.

Learn more! For details on major types of 1C:Enterprise script objects, see section 1C:Enterprise script objects used for operations with applied data.

AccumulationRegisterRecord.<name> provides access to accumulation register records. This object is not created directly. Instead, it is provided by other objects related to accumulation registers. For example, this object represents register records in a record set.

AccumulationRegisterRecordKey.<name> is a set of values that uniquely identify a register record. This object is used for referencing a specific record. For example, this object represents a value of the CurrentRow property of the tabular section that stores a list of register records.

For examples of operations with accumulation registers that involve 1C:Enterprise script objects, see listing 29.9.

Listing 29.9. Object usage examples

1.  // Global context
    // AccumulationRegisters
 
// Example: performing full recalculation of all totals in the BalanceOfMaterials register.
AccumulationRegisters.BalanceOfMaterials.RecalculateTotals();
 
2.  // AccumulationRegistersManager object
    // .<accumulation register name>
    // [<accumulation register name>]
    // For Each … In … Do … EndDo;
 
// Example: calculating totals of the BalanceOfMaterials register for the specified date.
RegisterName = BalanceOfMaterials;
AccumulationRegisters[RegisterName].SetMaxTotalsPeriod(SpecifiedDate);
 
3.  // AccumulationRegisterManager.<name> object
    // CreateRecordKey()
 
// Example: activating a specific row in the accumulation register list.
KeyFieldStructure = New Structure;
KeyFieldStructure.Insert("Recorder", Documents.GoodsReceipt.FindByNumber("0000002"));
KeyFieldStructure.Insert("LineNumber", 2);
Items.Materials.CurrentRow =
    AccumulationRegisters.BalanceOfMaterials.CreateRecordKey(KeyFieldStructure);
 
4.  // AccumulationRegisterManager.<name> object
    // CreateRecordSet()
 
// Example: getting register records created by a document.
RequiredDocument = Documents.GoodsReceipt.FindByNumber(4);
RegisterRecords = AccumulationRegisters.BalanceOfMaterials.CreateRecordSet();
RegisterRecords.Filter.Recorder.Value = RequiredDocument;
RegisterRecords.Read();
 
5.  // AccumulationRegisterManager.<name> object
    // Select()
    // SelectByRecorder()
 
// Example: selecting all records for the current month from the BalanceOfMaterials register.
Selection = AccumulationRegisters.BalanceOfMaterials.Select(BegOfMonth(CurrentDate()),
    EndOfMonth(CurrentDate()));
 
6.  // AccumulationRegisterRecordSet.<name> object
    // [<collection element index>]
    // For Each … In … Do … EndDo;
 
// Example: getting register records created by a document.
RequiredDocument = Documents.GoodsReceipt.FindByNumber(4);
RegisterRecords = AccumulationRegisters.BalanceOfMaterials.CreateRecordSet();
RegisterRecords.Filter.Recorder.Value = RequiredDocument;
RegisterRecords.Read();

For Each NextRecord In RegisterRecords Do
    // Register record processing algorithm
    …
EndDo;

Event sequence for writing accumulation register record sets from record set forms

Quick developer reference / Accumulation registers / Event sequence for writing accumulation register record sets from record set forms
Fig. 29.20. Event sequence for writing an accumulation register record set from a record set form

Note. Yellow boxes indicate events executed in the writing transaction.

Leave a Reply

Your email address will not be published.

 

1C:Enterprise Developer's Community