Calling other projects

This chapter requires good understanding of project parameters explained in the previous chapter of this tutorial.

In EasyMorph one project can call (run) another project, which is similar to using subroutines in programming languages. It might be convenient in a number of cases:

  • Move out part of a calculation logic into another project to reduce calculation complexity.
  • Execute the same calculation logic required in different parts of a project.
  • Execute the same calculation logic in different projects.

Calling another project

Use the Call transformation to call another project (subproject). With this transformation you can assign parameters of the subproject (if needed). Parameters of the subproject can be assigned either as constants, or using parameters of the calling (parent) project. Note that parameters must already be created in the called project prior to their assignment in Call transformation (see the previous chapter how to do it).

Returning a dataset from subproject

The Call transformation can run in one of the two modes:

  • Do not return result table — in this mode nothing is returned from subproject and the output of Call transformation is the same as its input. This mode is typically used when the subproject performs export operations or runs a Windows shell command (e.g. copies a file).
  • Return a table — in this mode a final dataset of particular table is returned from subproject. It becomes the output of Call transformation.

Advanced topics

The "Input" transformation (not available in the free edition)

It is possible not just return datasets from subprojects, but also pass datasets from parent projects into subprojects with the help of the "Input" transformation. This transformation should be inserted in the called subproject as a starting point of calculations. When inserted the transformation returns nothing. But when the subproject is executed, the Input transformation obtains the input dataset of the Call transformation of the calling (parent) project.

With the help of "Input" transformation it is possible to arrange two more ways of calling subprojects:

To simplify development and debugging, it is possible to copy a dataset from one project and paste it into Input transformation (similarly to Sandboxes).

Reusable projects and custom transformations

The ability to encapsulate a calculation logic into a subproject that can be used in many other projects enables creating reusable projects (which are effectively custom transformations). Such reusable projects can be convenient in various scenarios. For instance:

  • File operations: copying, deleting, renaming, archiving, etc. In this case subprojects run respective Windows shell commands generated using project parameters.
  • Common data quality checks. In this case subprojects frequently contain a Halt transformation to abort execution if some data quality checks are not passed.
  • Advanced calculations done with the help of an external application (e.g. written in Python or C#). The data exchange with the external application is typically done through text files: the subproject generates a CSV file, triggers the external application which reads the file and produces another CSV file with calculation results, which is then read back into the subproject. For a calling project calling such subproject is effectively similar to using a custom transformation.

Reusable projects tend to grow into libraries of reusable projects commonly used inside an organization.

Read next: Iterations