Skip to end of metadata
Go to start of metadata

Objects can be imported with an Excel connection. These imported objects are all shown on the same level. If you want the imported objects to be shown hierarchically, you can use a script. With this script objects can be indented to show hierarchy. This topic describes how you can import objects and arrange them using a script. Business functions are used as an example.

Steps:

  1. In your connection, add two Business Functions and use the following mapping:

    1. Column A is used to set the Parent ID
    2. Column B is used to import the objects.

    3. Column C is used to import the Composition relation




  2. Make sure the columns in your Excel sheet corresponds with the mapping. You can use an example like this:



  3. Import the Excel file. When using the above example, the model browser should look as below. The imported objects are all on the same level.



  4.  To arrange hierarchy run the below script. Open the Query editor, run the script, and refresh the model browser.

    forall "BusinessFunction" c1 in modelpackage
    {
      forall "BusinessFunction" c2 in c1.objectsWithRole("is part of")
      {
    	c1.moveTo(c2);
      }
    }


    The result looks as follows:




Below you can download an example model and Excel file:

BC.xlsx

BC.xma