Data Import association value


I’m using @mario 's data import, but I’m unclear as to how to accomplish a few things with an association reference. My entity that I’m importing (Rheometer) is as follows:

The compound attribute references the Compound entity, which is very simple:

The attribute mappers in the Import Configuration are all automatic and look like this:

If I do nothing to the Pre-Commit Script, this imports correctly. However, I’m trying to accomplish two things.

First, I’m trying to simply force the imported value for compound to uppercase. When I do the following in the Pre-Commit Script, the import fails with ‘Pre-Commit skipped’. The Pre-Commit Script looks like this:

entity.compound = entity.compound.toUpperCase()
return true

Second, after I’m able to force the compound value to uppercase, I need to be able to create the compound value as a Compound entity if the value doesn’t already exists. I’m guessing I need to do something else in the Pre-Commit Script, but I’m not very well-versed in Groovy.

Thanks for your help.