5 Replies Latest reply: Jul 16, 2013 7:40 AM by user476483 RSS

    Adding business information documents by program

    user13430807


      Hello,

       

      I want to add documents to the business information in Data Modeler and connect them to one or more tables. Since I have many documents, I want to do this by program.

      Is this possibile with a transformation script?

       

      Thanks in advance,

      Joop

        • 1. Re: Adding business information documents by program
          Dimitar Slavov-Oracle

          I think this should help you.

           

           

          // create single document

          info = model.getDesign().getBusinessInfoDesign()

          document = info.getDocumentSet().createDocument("");

          document.setName("name_1");

          document.setType("type_1");

          document.setReference("ref_1");

           

          // add document to each table

          tables = model.getTableSet().toArray();

          for (var t = 0; t<tables.length;t++){

          table = tables[t];

          table.addDocument(document);

          table.setDirty(true);

          }

          • 2. Re: Adding business information documents by program
            user13430807

            Hello Dimitar,

             

            the script works with some remarks:

            - when trying to execute the script I get an error: The function <xx> does not exist or is wrongly defined. The script evaluation is terminated.  Since you are not able to save the script, you can't execute it. However with the Debug option it works!

            - the API documentation does not describe the getDesign() procedure.

             

            Anyhow thanks for your help

             

            Joop

            • 3. Re: Adding business information documents by program
              user476483

              Hello Dimitar,

               

              i also used the script you suggest, but there is a problem.

               

              The new documents don't get a unique object_id, it's null.

              I created more than 1 document but I can't save them, only the last created document will be saved.

              By using the method  document.setObjectID(), I can create a unique Id.

              Do you have any suggestions how to get an unique object_id in the Data Modeler for the documents ?

              Or can i use the setObjectId() method with some value ??

               

              Thanks in advance,

               

              Daan

              • 4. Re: Adding business information documents by program
                Dimitar Slavov-Oracle

                Hi Daan,

                 

                My mistake. You should use createDocument() with null argument. Like this

                 

                info = model.getDesign().getBusinessInfoDesign()
                
                tables = model.getTableSet().toArray();
                for (var t = 0; t<tables.length;t++){
                     table = tables[t];
                
                     document = info.getDocumentSet().createDocument(null);
                     document.setName(table.getName() + "_doc");
                     document.setType("type_1");
                     document.setReference("ref_1");
                     document.setDirty(true);
                     document.addElement(table);
                
                     table.addDocument(document);
                     table.setDirty(true);
                }
                
                

                Thanks for noticing.

                 

                Also at last I found how to format code in the new forum

                "Switch to the advanced editor, paste your code, mark it, click the >> (insert) button, select Syntax Highlighting, choose the style."

                • 5. Re: Adding business information documents by program
                  user476483

                  That's much better, all my documents will be saved.

                   

                  Thanks