Skip to end of metadata
Go to start of metadata

New topics covered by this example

  • Creating object and attaching data to it without specifying it in the excel file
  • Exporting relations without exporting data not relevant in the excel file

The input data for this example are:

  • The Rule Maker template (you can ask for it at arkitect-support@k-inside.com)
  • An Excel file which you can see below

Creating object and attaching data to it without specifying it in the excel file

We will use the target model used in Export Specific Features which described Continent, Country, Town and People movement flow objects. In this part we will create a new continent called "America" with the countries and the towns in it described in the excel file above.

Icon

Even if the Continent object "America" already exists in the target model data will be attached to it as well

Preparing the Rule Model and Rule File

Use a VirtualColumn object to specify that an object of type Continent which are not specified in the excel needs to be created. Then edit the defaultValue attribute of the VirtualColumn object and set it as "America". Hence refer to the instructions of the first tutorial and create a new Rule Model with a Location sheet as pictured below:

Icon

There is no need to set a specific name to your VirtualColumn objects

Importing

Now we will import the excel file in the target model where a Continent object called "Asia" already exists as shown below:

Now Execute the Import script:

  • at the first Open File dialog, select the Rule File you have generated
  • at the second Open File dialog select the Excel File to be imported.

You should get the following result (the Continent object "America" has been expanded):

Exporting relations without exporting data not relevant in the excel file

VirtualColumn objects can also be used to filter data exported in an excel file. In this example we will perform an export to know how many people move between towns in the Country object called "India" without exporting information about the country in the excel.

Preparing the Rule Model and Rule File

Use a VirtualColumn object to specify that an object of type Country which are not specified in the excel is used in the relation. Then edit the valueFilter attribute of the VirtualColumn object and set it as "India". Hence refer to the instructions of the first tutorial and create a new Rule Model with a People movement flow in India sheet as pictured below:

We built the Rule Model to make the Model Gateway search first for People movement flow objects until reaching the VirtualColumn objects which filter data to export only towns of "India".

Icon

The valueFiler attribute of VirtualColumns might be empty. In our case all countries would have been taking into account.

Exporting

We will export data from the target model model below:

To export the target model data, run the Export script and select the Rule File at the File Open dialog. The Model Gateway will open Excel and create a new workbook with the exported data. To actually save the data to an Excel file, you need to use the Save command in Excel.
See the resulting excel file below:

  • No labels