Main > Knowledge Base > Knowledge Base > Knowledge base > Practical developer guide 8.3 > Lesson 26 (2:00). Picking list items, avoiding modal windows, and generating data based on other data > Generating data based on other data > Creating a document generation command > In Designer mode > Practical developer guide 8.3 > Lesson 26 (2:00). Picking list items, avoiding modal windows, and generating data based on other data > Generating data based on other data > Creating a document generation command > In Designer mode

In Designer mode

Let us implement the document generation.

  1. Open the configuration object editor for the Services document.
  2. Add a document attribute named BasisObject of CatalogRef.Customers type.
    Creating the attribute is not required for document generation, it is only needed for building a chain of dependent documents in the future.
    Let us specify the documents that can serve as a basis for generating the Services document, and the list of documents that can be generated based on the Services document. 
  3. On the Generation tab, in the Can be generated based on pane, click the Edit List item button and select the Customers catalog (fig. 26.5).


    Fig. 26.5. Defining the assortment of objects that can serve as a basis for the document generation
  4. Click Generation settings wizard.
    Let us specify the attribute values for a document to be generated.
  5. Click Fill Expressions (fig. 26.6).


    Fig. 26.6. Filling attribute values for a generated document

    Note that the wizard suggests using the FillingData.Ref value for filling the BasisObject attribute. In this scenario this record is redundant because a reference to a catalog is passed as a basis.

    However, in general, the Filling event comes up when an object is created based on a passed value (which might not have the reference type).
  6. Click OK.

    This generates the Filling event handler script in the document module (listing 26.12).

    Listing 26.12. Filling event handler

    Procedure Filling(FillingData, StandardProcessing)
        //{{__CREATE_BASED_ON_WIZARD
        // This fragment was built by the wizard.
        // Warning! All manually made changes will be lost next time you use the wizard.
        If TypeOf(FillingData) = Type("CatalogRef.Customers") Then
            // Filling the headline
            Customer = FillingData.Ref;
            BasisObject = FillingData.Ref;
        EndIf;
        //}}__CREATE_BASED_ON_WIZARD
    EndProcedure
    As you can see, an If... condition is generated for each type of basis object, and the attributes of the new document are filled within that condition.
Next page: In 1C:Enterprise mode



© 1C LLC. All rights reserved
1C Company respects the privacy of our customers and visitors
to our Web-site.