Crmgo Blog

Metadata

Metadata

// Iterate through the attributes of all information registers Procedure Form () For Index = 1 to Metadata . Register () Loop DocIdent = Metadata . Register ( Index ). Identifier ; Notify ( "Register " + DocIdent ); For ReqInd = 1…

Metadata

// Iterating through the attributes of all information base catalogs
Procedure Generate()

    For Index=1 to Metadata.Catalog() Do
        DocIdent = Metadata.Catalog(Index).Identifier;
        Message("Catalog "+DocIdent);
        For AttrIndex=1 to Metadata.Catalog(DocIdent).Attribute() Do
            Message("- catalog attribute -  "+Metadata.Catalog(DocIdent).Attribute(AttrIndex).Identifier);
        EndDo;
        Message("********************");
    EndDo;

EndProcedure

// Iterating through the attributes of all information base documents
Procedure Generate()

    // Iterating through common document attributes
    For AttrIndex=1 to Metadata.CommonDocumentAttribute() Do
        Message("- common attribute -  "+Metadata.CommonDocumentAttribute(AttrIndex).Identifier, "!");
    EndDo;

    For=1 to Metadata.Document() Loop
        DocID = Metadata.Document(Index).Identifier;
        Notify("Document "+DocID);
        For ReqIndex=1 to Metadata.Document(DocID).HeaderRequirements() Loop
            Notify("- header requirement - "+Metadata.Document(DocID).HeaderRequirements(ReqIndex).Identifier);
        EndLoop;
        For ReqIndex=1 to Metadata.Document(DocID).TablePartRequirements() Loop
            Notify("- table requirement - "+Metadata.Document(DocID).TablePartRequirements(ReqIndex).Identifier);
        EndLoop;

        Notify("********************");
    EndLoop;

EndProcedure

// Iterating through the requirements of the "ReceiptCashOrder" document
// DocumentData - a Table of Values located on the processing form

Procedure Generate()

    PKODoc = CreateObject("Document.ReceiptCashOrder");

    For N = 1 to Metadata.Document("ReceiptCashOrder").HeaderRequirements() Loop

        DocumentData.NewColumn(Metadata.Document("ReceiptCashOrder").HeaderRequirements(N).Identifier,,,,,,,);

    EndLoop;

    DokPKO.SelectDocuments(StartDate, EndDate);

    While DokPKO.GetDocument() = 1 Do

        DocumentData.AddRow();

        For N = 1 to Metadata.Document(DokPKO.Type()).HeaderAttributes() Do
            DocumentData.SetValue(DocumentData.RowNumber,MetaData.Document(DokPKO.Type()).HeaderAttributes(N).Identifier,DokPKO.GetAttribute(MetaData.Document(DokPKO.Type()).HeaderAttributes(N).Identifier));
        EndDo;

    EndDo;

EndProcedure

Note: This post may be AI-assisted and then human-edited. Editorial responsibility: Dmytro Lomaka, Kaltenkirchen.

Categories: 1C