In Designer mode

How does one do it? This is definitely a good question. Let us look at the Data lock control mode configuration property. This property has the Managed value (fig. 14.31).

Fig. 14.31. Data lock control mode in configuration properties

This means that you have to use managed locks, which are set using 1C:Enterprise script tools.

You need to lock the data you intend to read and subsequently modify. This is implemented using the LockForUpdate property of register record sets. Let us use this property.

  • Insert the lines shown in listing 14.41 before writing empty record sets.

    Listing 14.41. Posting() procedure (fragment)

        |    ON DocumentMaterialsAndServices.MaterialOrService = BalanceOfMaterialsBalance.Material";
    // Setting data locks for the CostOfMaterials and BalanceOfMaterials registers
    RegisterRecords.CostOfMaterials.LockForUpdate = True;
    RegisterRecords.BalanceOfMaterials.LockForUpdate = True;
    // Writing empty record sets to read balances without the data added by this document
    QueryResult = Query2.Execute();

A managed lock is applied at the moment of writing these record sets, right before the execution of the second query. This is exactly what we wanted to achieve.

Next page: Marking custom module regions

Be the first to know tips & tricks on business application development!

A confirmation e-mail has been sent to the e-mail address you provided .

Click the link in the e-mail to confirm and activate the subscription.