web analytics

Did You Know? : DRY Code – Import/Export

DRY

When building out any logical process, it is common to imagine reusability of components that you have built.  Whether that is making a copy for yourself to take in a different direction, building out a template, or taking a subset of functionality and modularizing it, it can all lead to the design principle of Don’t Repeat Yourself, or DRY.

Did you know that Composable DataFlows can be shared and reused, even on another instance?

As an example, let’s explore the DataFlow created in the first lab from the NASDAQ API Project Lab Series, with the wire type changed to Flow Chart here.

Export

Initially, our DataFlow looks something like this (you may or may not have added comments here):

Original DataFlow

Now, if we wanted to share this with a colleague, there are a number of different options, depending on the use case.  In our example, we will need to share an existing DataFlow with colleagues who are using a different instance of Composable (you).

With our DataFlow open in Designer view, we can look to the Designer Toolbar at the top of the canvas and click Export in the middle of the bar.

Export from the Designer Toolbar

That creates and downloads a JSON file that contains all of the information defined in the DataFlow.  The default name is the name of the DataFlow, as seen (and managed in) Manage DataFlow > Details, to the right of the Designer canvas.

DataFlow Name
Exported JSON file

You could now share this file with a colleague, enter it into an external version control system (although Composable has robust version control), or store it locally.

Import

To import an exported DataFlow JSON file, simply create a new DataFlow and return to the toolbar above the canvas.  Click Import.

Import from the Designer Toolbar
Import DataFlow

Choose the JSON File.  I will pick the one that we just exported.

Finding the downloaded JSON file
Selecting the file

After completing the file selection, the Import DataFlow window confirms that a file has been chosen and activates the Confirm button.  Note that you do have the option to overwrite whatever DataFlow you are in, but I usually start from a clean canvas, so that I wouldn’t need to.

Importing a DataFlow

Select Confirm and that’s it.

Now our canvas is filled with a new copy of our old DataFlow, including comments, Name, Description, even the position of modules on the canvas and different Wire Type.

New Copy, Old Flow

It’s just that easy.