Reusable Projects

I’ve used EasyMorph with some success transforming and cleaning up data from one source, making it usable for importing into another system. Because I’m a hack and not a programmer, I’m stuck on something that I know EasyMorph will easily do, but that I can’t figure out.

I’ll stick with one specific example of what I want to do and, once I figure it out, I can expand on my own.

I have contact information (name, address, email, phone, etc.) that come from a few different sources that I use EasyMorph to transform and use as input to a rigid CRM system. Let me focus on street address as my example. I want to process the various input sources through the same Street Address clean-up and transformation logic. So, I think I want an EasyMorph project that holds a set of transformations/actions for Street Address and then “call” that subproject in the project I use to process each input source.

Here’s what happened thus far. I work on one of the sources. I get all the transformations/actions figured out. It creates files that I need to use for importing to the CRM. All is well. I move on to another source from a different system. I start with a copy of the first project as a starting place. As I work on the new project with different input I end up improving or correcting the logic I used for the street address transformation. If I remember, I’ll go back to the original project and incorporate the improved or corrected logic. There must be a better way. I’ve read the Tutorials and Examples and I’ve gotten close, but can’t get the concepts to gel in my head.

Of course once I figure this out, I’ll end up using “Reusable Projects” for other groups of fields (name, email, etc.).

Thanks, Rob

Hi Rob,

I guess, you’ve read already the tutorial article on Subprojects, so here is an example that illustrates it. The example does the following:

  1. main.morph obtains a list a random addresses from the internet: downloads this HTML page.

  2. main.morph cleans up the list:

  • Saves it into a temporary file.
  • Calls address-cleanup.morph and passes to it the name of the temporary file.
  • Retrieves the result from address-cleanup.morph.
  • Deletes the temporary file.
  1. In turn, address-cleanup.morph does the following:
  • Reads the temporary file
  • Removes all rows that are not HTML list items
  • Parses HTML list items and extracts Name, Address 1, Address 2, and Phone number from them.

main.morph (4.0 KB)
address-cleanup.morph (2.7 KB)

Notice how the Call action is configured in main.morph:

(1) The Mode is set to “Return table” which means that after the “Call” action executes address-cleanup.morph the final state of the specified table will be returned into main.morph and will become the result of the “Call” action.

(2) The {File} parameter of address-cleanup.morph is assigned from the “Call action”.

The subproject (address-cleanup.morph) can be re-used in other projects as long as it’s provided with a path to file from which it can read a “dirty” list of addresses.